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

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 helpwanted, Today, 03:06 AM
        1 response
        11 views
        0 likes
        Last Post sarafuenonly123  
        Started by Brevo, Today, 01:45 AM
        0 responses
        9 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        387 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X