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

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];
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by helpwanted, Today, 03:06 AM
        0 responses
        3 views
        0 likes
        Last Post helpwanted  
        Started by Brevo, Today, 01:45 AM
        0 responses
        7 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X