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 value

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

    store value

    Hello,

    I have a problem and couldnt find an answer in the forum or do not understand correctly. I simply want to store the high and low of a bar to a double when a condition is true. I have done in my script, but the problem is that when the condition is true with the next bars, the high and the low in my double is changing with every bar. But I need to have stored always the high and low of the first bar when condition was true, and not changing the double with from the next bars.

    Thank you
    Tony
    Last edited by tonynt; 01-20-2017, 10:34 AM. Reason: typing error

    #2
    Hello Tony,

    Use a bool that is initialized as false.

    Require the bool to be false to set the double variable values.

    When the values are set set, set the bool to true.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Could you give an example of storing the high price?

      Thanks.

      Comment


        #4
        brucelevy,

        here it is how I do:

        in region Variables:

        double myhighprice = 0;
        double mylow = 0;

        in region OnBarUpdate

        if(your conditions)
        {...
        myhighprice = High[0];
        mylow = Low[0];
        ...
        }

        Best
        Tony
        .
        Last edited by tonynt; 02-23-2017, 12:30 AM. Reason: clearifiying

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Brevo, Today, 01:45 AM
        0 responses
        2 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        3 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        238 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
         
        Started by oviejo, Today, 12:28 AM
        0 responses
        4 views
        0 likes
        Last Post oviejo
        by oviejo
         
        Working...
        X