Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Catching a High of a bool-condition

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

    Catching a High of a bool-condition

    Hi,

    having following condition that describes the bar i need :

    (CrossAbove(EMA(12), EMA(26), 20))

    Now i try to get + conserve th High of the price-bar at the moment this bool-condition is true to use it later to compare it to other Highs.

    How can i do this ?
    Thank you!

    #2
    How about creating a variable in the variables section:

    private double myHigh;

    then in OnBarUpdate()

    if (CrossAbove(EMA(12), EMA(26), 20))
    myHigh = High[0];

    then you can compare myHigh later.
    RayNinjaTrader Customer Service

    Comment


      #3
      thank you !

      whats the differents between
      a private double myHigh; in the variable section and

      a double blabla ; in the OnBarUpdate() section ?

      Comment


        #4
        Hi brain77,

        If you declare your variable in the Variables section, it will be available anywhere in your code, whereas the one in the OnBarUpdate() will only be locally available. So if you need to store a quick temporal calcuation, it is very convenient...

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        581 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        338 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X