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() explained..?

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

    PriorDayOHLC() explained..?

    Creating an intraday strategy (10 min bars): Does PriorDayOHLC.PriorClose[0] (index 0) give the close of the last intraday bar while PriorDayOHLC.PriorClose[1] gives the close of the last session?

    Also, I notice that PriorDayOHLC.PriorClose and PriorDayOHLC.PriorOpen does not give the same values as the Open and Close of a daily chart for that day. Are daily bars formed from 00:00->24:00 while PriorDayOHLC operate with session time (futures 6pm -> 5 pm)? Is there a way to get session bars instead of daily?

    #2
    Hello haakonflaar,

    Thank you for your post.

    PriorDayOHLC offers the prior session's Open, High, Low, and Close values. It will not give the close value of an intraday bar. If you happen to want an intraday Open, High, or Low, you could use Current Day OHL:Otherwise, for an intraday Close value you would simply use the Close series:The way the indexing works for the PriorDayOHLC indicator depends on the input series. For example, if you have a minute chart and it's the middle of the day, both PriorDayOHLC.PriorClose[0] and PriorDayOHLC.PriorClose[1] would give the same value because both the current bar from the minute series and 1 bar ago on that minute series have the same prior day close value. Additionally, the PriorDayOHLC indicator will honor the Trading Hours template used for the input series whereas the values from a daily chart are based on the OHLC given from your data provider and do not change if you change the Trading Hours in the data series settings. That means that daily bars are formed based on the trading hours/session time your data provider uses for the instrument and PriorDayOHLC could vary based on which Trading Hours you choose. You could use a 24/7 session template if you'd like to get from 0:00 to 24:00 or you could use the ETH or RTH for the instrument type, etc.

    If you'd like to get "daily" bars that allow you to specify the trading hours, you could load a 1440 minute chart instead of a daily chart. This will build bars based on minute data, and there are 1440 minutes in a day. For more info on how bars are built:
    Some data providers offer a settlement-adjusted close price on daily bars. You can determine if your provider offers the settlement adjusted price by checking the final column on the following page:
    I understand this is a lot of information. If there is something specific you are looking to achieve with the Prior Day OHLC information, please describe what you are looking for and I would be glad to provide an example.

    Please don't hesitate to reach out with any additional questions or concerns.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply NinjaTrader_Emily. I am not sure if I fully understand it. Could you provide code for the following two examples:

      In both cases the primary (and only) series is a 20 minute bar series. I want to do the following:
      1. Check if yesterday's session close was higher than yesterday's session open.
      2. Check if today's session open was higher than yesterday's session close. This needs to be checked sometime in the middle of the session so I need today's close even though the session is still ongoing.

      Comment


        #4
        Hello haakonflaar,

        Thank you for your reply.

        I have provided a snippet for each of your questions below for a 20-minute series.

        1. Check if yesterday's session close was higher than yesterday's session open.
        Code:
        // checks if the prior day's close is greater than the prior day's open.  we use 0 bars ago because that will check for the session prior to that of the current bar
        if (PriorDayOHLC().PriorClose[0] > PriorDayOHLC().PriorOpen[0])
        {
        // do something here
        }
        2. Check if today's session open was higher than yesterday's session close.​
        Code:
        // check if the current day's open is greater than the prior session's close
        if (CurrentDayOHL().CurrentOpen[0] > PriorDayOHLC().PriorClose[0])
        {
        // do something
        }
        You mentioned "This needs to be checked sometime in the middle of the session so I need today's close even though the session is still ongoing." though today's session open and yesterday's close have nothing to do with today's current close. I'm not exactly sure what part of today's close needs to be checked with this; please provide an example so I may better understand what you are looking for.

        Please let me know if I may be of further assistance.
        Emily C.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cummish, Today, 08:43 PM
        0 responses
        5 views
        0 likes
        Last Post cummish
        by cummish
         
        Started by Option Whisperer, Today, 07:58 PM
        4 responses
        18 views
        0 likes
        Last Post Option Whisperer  
        Started by ETFVoyageur, 05-07-2024, 07:05 PM
        13 responses
        86 views
        0 likes
        Last Post ETFVoyageur  
        Started by cupir2, Today, 07:44 PM
        0 responses
        9 views
        0 likes
        Last Post cupir2
        by cupir2
         
        Started by reynoldsn, Today, 07:23 AM
        6 responses
        20 views
        1 like
        Last Post reynoldsn  
        Working...
        X