Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Record price at event, more variables

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

    Record price at event, more variables

    Hi, I'm converting a strategy to an indicator and need to record the current price at an event, then add the value of a stop loss (user defined input), so I can simulate being flat again after a stop out within the indicator.
    Also I have used up the 10 user defined variables and need some more, it won't compile if I go to variable10, what do I do?
    Thanks

    #2
    Stem1, for the user defined inputs, you can definitely create yourself more, here's a detailed tip with a 'how to' - http://www.ninjatrader.com/support/f...ead.php?t=5782

    You can record / store your price in a variable when your event occurs - i.e.

    if (CrossAbove(SMA(10), SMA(20), 1))
    trackingVar = Close[0];

    Comment


      #3
      Ok, inputs I can do, it's the Variables I have run out of. Can "trackingVar" be numbered like trackingVar1 etc?
      There's "no topic" in the help guide.
      Thanks

      Comment


        #4
        Sure, you can name your custom variables whatever you want to - just declare them for example like

        private double trackingVar1;

        in your class.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        131 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        74 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        117 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        111 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        89 views
        0 likes
        Last Post CarlTrading  
        Working...
        X