Announcement

Collapse
No announcement yet.

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.

    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]).

        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

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            566 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            329 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            547 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            548 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X