Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

PriorDayOHLC().PriorHigh[1]

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

    PriorDayOHLC().PriorHigh[1]

    Am I able to use the following to find to high of the day before the last day ?
    PriorDayOHLC().PriorHigh[
    1]

    currently it is returning 0 for some reason

    #2
    Hello Fiddy,

    Thank you for your post.

    The bar index [ ], will refer to the number of bars ago value for that indicator.

    Since, you are requesting 1 bar ago, on intraday time, the 0 and 1 will return the same value.

    The only time that this isn't true, is when it is the first bar of session.

    You can filter this out with -
    Code:
    if(Bars.FirstBarOfSession)
    {
         Print("Bar 0: " + PriorDayOHLC().PriorHigh[0]);
         Print("Bar 1: " + PriorDayOHLC().PriorHigh[1]);
    }
    Let me know if I can be of further assistance.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      How would you suggest a better way / correct way to write the following

      PriorDayOHLC().PriorLow[0] > PriorDayOHLC().PriorHigh[1]

      What I want is the low from yesterday to be greater than the high of the day before yesterday.
      However I want to run this on an intraday chart

      Comment


        #4
        Fiddy,

        What you would want to do is check for the price change between the [0] and [1], and then store the value you want to use later.

        if(PriorDayOHLC().PriorHigh[0] != PriorDayOHLC().PriorHigh[1])
        {
        newDay = PriorDayOHLC().PriorHigh[1];
        }

        if(PriorDayOHLC().PriotLow[0] > high)
        {
        // Take action here
        }
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        149 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        84 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        129 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        125 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        102 views
        0 likes
        Last Post CarlTrading  
        Working...
        X