Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Low[0] value saved as variable for furher use

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

    Low[0] value saved as variable for furher use

    Hello!
    I am trying to save the value of a bar such as Low[0], and to be able to use it in the future.
    Here is what I have done:
    HTML Code:
    doubleLow;
    bool breakh = false;
    If (EMA(Close, 5) > EMA(Close, 7))
    {
      doubleLow = Low[0] ;
      breakh = true;
    }
    ​
    I am using the Boolean here to avoid having the value of doubleLow changed and takes the values of subsequent bars after the condition is met for the first time.;
    At this point, the low of the bar where the crossover occurred is saved in doubleLow. The prices moved up for a certain period of time (the time span is not important here) and finally drop and close below doubleLow. Here, I do the math as follow:
    HTML Code:
    If(Low[0] < doubleLow && breakh)
    {doTheMath;}
    ​
    The problem here is that I am not having the math done!

    I would appreciate any help.

    #2
    Hello Stanfillirenfro,

    The CurrentDayOHL indicator does something similar.
    The currentLow variable is set to whichever is lower, the bar low, or the saved low, and is reset at the start of a new session.

    Use Print() to understand behavior.
    Print the time of the bar and all values used in a conditions or custom calculations and add labels for each value and comparison operator.
    https://ninjatrader.com/support/foru...121#post791121

    Provide the output from the prints saved to a text file.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    576 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    334 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    553 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X