Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How do I "look ahead" in bar data?

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

    How do I "look ahead" in bar data?

    Hi,

    I know this is usually a big no-no in the world of backtesting/strategy development... but I really do have a need to look ahead at *future* data from a historical bar, for one of my backtests.

    I'm just trying to define the range of values that I should be focusing on... so say, for example, on Monday I'd like to figure out the high/low for the rest of the week, so that I can define special debugging messages close to those prices.

    How do I do this? How do I get access to High/Low/Close from future bars?

    #2
    heech,

    You can't. NinjaTrader does not allow peaking into the future. If this is something you need I suggest you preexamine your data charts and write the necessary information to a text file and just read from the file at specific dates.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Josh View Post
      heech,

      You can't. NinjaTrader does not allow peaking into the future. If this is something you need I suggest you preexamine your data charts and write the necessary information to a text file and just read from the file at specific dates.
      Ok, that's what I'll do then.

      Comment


        #4
        I am trying to do something similar. Basically, I want to look at indicator values every 5 minutes for the prior session and use them in the current session with an offset (i.e. Look at the 1:40 data from yesterday at 1:05 today to sort of forecast what the indicator value might be if history repeats itself). I'm using this to try to forecast future volatility.

        I've tried to just reference approximately 77 bars ago of 5 min bar data, but I always get the 'index out of range' not enough data error, even though I see more than 77 bars of data on my chart. (there are 84 5-min bars each session, so on the current session, looking back only 77 or so would be effectively looking ahead 35 minutes using yesterday's data).

        Any ideas as to the best way to do this? Why can't my strategy process the indicator calculations on the 5 min bar data if I see more than 77 bars? Thanks,

        kc

        Comment


          #5
          Originally posted by kcsystemtrader View Post
          I am trying to do something similar. Basically, I want to look at indicator values every 5 minutes for the prior session and use them in the current session with an offset (i.e. Look at the 1:40 data from yesterday at 1:05 today to sort of forecast what the indicator value might be if history repeats itself). I'm using this to try to forecast future volatility.

          I've tried to just reference approximately 77 bars ago of 5 min bar data, but I always get the 'index out of range' not enough data error, even though I see more than 77 bars of data on my chart. (there are 84 5-min bars each session, so on the current session, looking back only 77 or so would be effectively looking ahead 35 minutes using yesterday's data).

          Any ideas as to the best way to do this? Why can't my strategy process the indicator calculations on the 5 min bar data if I see more than 77 bars? Thanks,

          kc
          Keep in mind your strategy runs on *every* bar... so is it running on historical bars, in which there aren't Close[77] bars available?

          When you setup your strategy, set "Min bars. required" to 77.

          Comment


            #6
            Originally posted by heech View Post
            Keep in mind your strategy runs on *every* bar... so is it running on historical bars, in which there aren't Close[77] bars available?

            When you setup your strategy, set "Min bars. required" to 77.
            Duh! That fixed it. Thanks!

            Comment


              #7
              Hi, I have a similar question.
              I have an indicator plotting future close.
              When I try to reference that indicator from a strategy, it's not giving back the correct future value. Is this kind of use not possible?

              I just want to do this to produce cvs file for NN training.
              Would appreciate your advise.

              Comment


                #8
                Originally posted by hana_maui View Post
                Hi, I have a similar question.
                I have an indicator plotting future close.
                When I try to reference that indicator from a strategy, it's not giving back the correct future value. Is this kind of use not possible?

                I just want to do this to produce cvs file for NN training.
                Would appreciate your advise.
                Hana, how do you call the indicator? Would it set a future value as the CurrentBars plot, so at index [0]? I would just shift the target values for the NN in Excel itself, that should be easier to handle...

                Comment


                  #9
                  Dear Mr. Bertrand,

                  Thanks for the reply.
                  In the indicator, it just shifts back the close[0] to the past, so the [0] of the indicator will be showing the close of the future bars.
                  I think I will just do this in excel.
                  Thanks for the advice.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  670 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  379 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  111 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  575 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  582 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X