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

How to get daily OHLC info from intraday bar

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

    How to get daily OHLC info from intraday bar

    At the first bar of a new session(5min chart), I would like to read the OHLC information (daily) of the previous 5 days.

    Can I use Bars.GetDayBar(1).High (for the high of the previous day)
    Bars.GetDayBar(2).High (for the high of two days ago)
    Bars.GetDayBar(3).High (for the high of three days ago)
    ...

    Similarly for other daily data.

    Thanks

    #2
    Hello mandm,

    Thanks for your post and welcome to the forums!

    Yes, the GetDayBar method will provide that data based on the 5 minute chart data and session template employed. Reference: http://ninjatrader.com/support/helpG...?getdaybar.htm

    You will also want to perform a check to ensure that you have enough data loaded before accessing the GetDayBar method, keep in mind you are creating day bars from the charts 5 minute bars.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Paul View Post
      Hello mandm,

      Thanks for your post and welcome to the forums!

      Yes, the GetDayBar method will provide that data based on the 5 minute chart data and session template employed. Reference: http://ninjatrader.com/support/helpG...?getdaybar.htm

      You will also want to perform a check to ensure that you have enough data loaded before accessing the GetDayBar method, keep in mind you are creating day bars from the charts 5 minute bars.
      Does this mean BarsArray[1] is referencing the day bars?

      Comment


        #4
        Hello,

        Thanks for your post.

        The Bars.GetDayBars() method would only work with the charts data series (BarsArray[0]).
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Paul View Post
          Hello mandm,

          Thanks for your post and welcome to the forums!

          Yes, the GetDayBar method will provide that data based on the 5 minute chart data and session template employed. Reference: http://ninjatrader.com/support/helpG...?getdaybar.htm

          You will also want to perform a check to ensure that you have enough data loaded before accessing the GetDayBar method, keep in mind you are creating day bars from the charts 5 minute bars.
          What is the proper way to perform a check to ensure there is enough data loaded?

          Comment


            #6
            Hello,

            Thanks for your post.

            You must check for a null reference since null is returned if there is insufficient intraday data to build a trading day bar.

            Example from the helpguide:

            if (Bars.GetDayBar(1) != null)
            Print("The prior trading day's close is: " + Bars.GetDayBar(1).Close.ToString());

            Reference:
            http://ninjatrader.com/support/helpG...?getdaybar.htm
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by daniel_weber8, Today, 01:21 PM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_ChristopherS  
            Started by jungsoohuh, Today, 12:07 PM
            1 response
            25 views
            0 likes
            Last Post NinjaTrader_PaulH  
            Started by SharonSS, Today, 11:54 AM
            1 response
            18 views
            0 likes
            Last Post NinjaTrader_Jim  
            Started by crystalet, Today, 11:20 AM
            3 responses
            22 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by SuperDude123, Today, 09:23 AM
            1 response
            34 views
            0 likes
            Last Post NinjaTrader_JustinD  
            Working...
            X