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 gentlebenthebear, Today, 01:30 AM
            2 responses
            13 views
            0 likes
            Last Post gentlebenthebear  
            Started by Kaledus, Today, 01:29 PM
            2 responses
            8 views
            0 likes
            Last Post Kaledus
            by Kaledus
             
            Started by frankthearm, Yesterday, 09:08 AM
            13 responses
            45 views
            0 likes
            Last Post frankthearm  
            Started by PaulMohn, Today, 12:36 PM
            2 responses
            16 views
            0 likes
            Last Post PaulMohn  
            Started by Conceptzx, 10-11-2022, 06:38 AM
            2 responses
            56 views
            0 likes
            Last Post PhillT
            by PhillT
             
            Working...
            X