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 Mongo, Today, 11:05 AM
            4 responses
            14 views
            0 likes
            Last Post Mongo
            by Mongo
             
            Started by traderqz, Today, 12:06 AM
            7 responses
            14 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by Skifree, Today, 03:41 AM
            5 responses
            13 views
            0 likes
            Last Post Skifree
            by Skifree
             
            Started by traderqz, Yesterday, 09:06 AM
            5 responses
            35 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by guillembm, Today, 11:25 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X