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 TraderBCL, Today, 04:38 AM
        0 responses
        1 view
        0 likes
        Last Post TraderBCL  
        Started by Radano, 06-10-2021, 01:40 AM
        19 responses
        606 views
        0 likes
        Last Post Radano
        by Radano
         
        Started by KenneGaray, Today, 03:48 AM
        0 responses
        4 views
        0 likes
        Last Post KenneGaray  
        Started by thanajo, 05-04-2021, 02:11 AM
        4 responses
        470 views
        0 likes
        Last Post tradingnasdaqprueba  
        Started by aa731, Today, 02:54 AM
        0 responses
        5 views
        0 likes
        Last Post aa731
        by aa731
         
        Working...
        X