Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Store price, Green lines, and Backtest Optimization

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Store price, Green lines, and Backtest Optimization

    hello,,

    having three issues:

    1. I want to store a price. For example:
    Code:
    [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (Position.MarketPosition == MarketPosition.Flat)[/SIZE][/FONT]
    [SIZE=2][FONT=Courier New]{[/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2]
    [SIZE=2][FONT=Courier New]startPrice = Position.AvgPrice;[/FONT][/SIZE]
    [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
    [/SIZE][/FONT]
    This doesn't seem to work.
    How do I store the current price ?



    2. I am getting green comment lines next to parameters that I've added. Later, the green lines are also next to the code containing the paramters. This seems to be affecting the strategy's performance, as if these commands are being ignored.

    How do I ensure that these are not being ignored ?





    3. The parameters I've added manually are not showing-up in the Parametres tab in the Backtest Optimizer. Instead, they show-up under the Misc tab, and cannot be optimized.

    How do I make sure that these parameters are listed under Parameters instead of Misc ?


    Attached Files

    #2
    Hello Faspomy,

    Thank you for your post.

    May I test your code on my end? Or do you have a toy version of the code I can test on my end?

    If you would like you can send the file to support[at]ninjatrader[dot]com with 'ATTN: Patrick - 839353' in the subject line and a reference to this thread in the body of the e-mail: http://www.ninjatrader.com/support/f...ad.php?t=57611

    I look forward to your response.

    Comment


      #3
      Originally posted by Faspomy View Post
      hello,,

      having three issues:

      1. I want to store a price. For example:
      Code:
      [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (Position.MarketPosition == MarketPosition.Flat)[/SIZE][/FONT]
      [SIZE=2][FONT=Courier New]{[/FONT][/SIZE][/SIZE][/FONT]
      [SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New]startPrice = Position.AvgPrice;[/FONT][/SIZE]
      [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
      [/FONT][/SIZE]
      This doesn't seem to work.
      How do I store the current price ?



      2. I am getting green comment lines next to parameters that I've added. Later, the green lines are also next to the code containing the paramters. This seems to be affecting the strategy's performance, as if these commands are being ignored.

      How do I ensure that these are not being ignored ?




      3. The parameters I've added manually are not showing-up in the Parametres tab in the Backtest Optimizer. Instead, they show-up under the Misc tab, and cannot be optimized.

      How do I make sure that these parameters are listed under Parameters instead of Misc ?

      1. The current price is Close[0]. You cannot store the average price of a position that is flat, because a flat position means that a position does not exist.

      2. You have to compile the code before it will be reflected.

      3. Specify a GridCategory for the parameters. For examples, look into the code of existing indicators/strategies that have parameters.

      Comment


        #4
        Thank you Patrick and Koganam !

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        11 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Yesterday, 08:42 PM
        0 responses
        10 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Yesterday, 07:51 PM
        0 responses
        11 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,981 views
        3 likes
        Last Post jhudas88  
        Started by rbeckmann05, Yesterday, 06:48 PM
        0 responses
        9 views
        0 likes
        Last Post rbeckmann05  
        Working...
        X