Announcement

Collapse
No announcement yet.

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 sjsj2732, Yesterday, 04:31 AM
        0 responses
        33 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        286 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        284 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        133 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        91 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X