Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Major potential problem...

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

    Major potential problem...

    This may not be a problem, but may be a problem. So I need some clarification before moving forward.

    After playing with the strategy Analyzer a bit, I notice that whatever time you set as the session begin time, it will start building your time bars from that time. So if you put it at like 8:30 and run a strategy you get very different results than if you did 8:31.... same with session end time.. if you put 2:45 and then run again with 2:46 the results seem to be very different...

    The reason for this as I understand it is simply because if you set the start time at say 8:30 and are doing 5 minute bars, it starts building the bars from that time... the bars it uses to evaluate the strategy are only bars that were generated and collected from say the 8:30 to 2:45 session start/end times specified.. All other bars outside of that range is not used... So by just changing the start or end time by 1 minute completly changes the way all the bars you had looked.. thus producing differnet back-testing results..

    Is everything up to this point accurate?

    Now the potential problem comes in when running the strategy live.. Lets say I have had ninja trader up and running and viewing a chart of the instrument I plan to trade..... lets say its 8:00 AM and i turn the strategy on.. I set its session begin and end time as 8:30 and 2:45 respectively.. Is it going to do the SAME exact way as in strategy analyzer? Where its going to look at the past few days of historical data and generate the bars ACCORDING to the start and stop times? Or will it just use all the bars it already has collected from it being connected to the feed that morning?

    I guess what i'm getting as is it going to create the bars from the past few days EXACTLY the same way as strategy analyzer would to feed to my now real time trading?

    I need to be 100% certain this will be accurate, if not my strategies will fall apart...

    Thanks

    #2
    frostengine,

    In realtime your bars are built based on real-time data. Perhaps the description and drawings in this article can be of assistance to you: http://www.ninjatrader-support.com/H...struments.html
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I am using CalculateOnBar=true..so it should not have a difference from what the historical data had. However, that is not really the question. The question is on the actual building of the bars..

      So lets say its 8:30 in the morning and my strategy is starting up. Well its already going to have some data there that populated the current indicators. So its entirely possible right at 8:30 its already making a trade based on those bars it already had. However, what i'm asking is are those bars going to include all the 5 minute bars that happened previously, or is it ONLY going to include the bars from the days prior that occured during the session start/end times I provided.. and were those bars calculated using the start/end time when building those bars.

      I may not be explaining this right?

      Comment


        #4
        Not sure I follow. If you set your sessions to be 8:30 to 2:45 the 8:30 bar will build when data that would fit into that bar starts flowing. There is nothing over at 2:45 that will fill into an 8:30 bar.

        Try this. Open a 5min chart and then open a 1min chart of the same instrument. Then you will be able to see what goes where and program your strategy accordingly.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Correct, nothing from 2:45 is filling into the bar.. where the session end comes into play is how the last bars look.

          So lets say we are trading a strategy that uses RSI(14,3).. 8:30 rolls around and the strategy is starting.. we have all of yeterdays data already populating these indicators.. so when it starts trading at 8;30 the RSI is using the last 14+ bars from the previous day to generate the value of RSI that we see at exactly 8:30.... So if the session end time is not 2:45 and is another value, then the shape of the bars from the previous day that is being used to calculate the RSI today will be different....

          What i'm asking is will the real time shape the bars in the EXACT way (using the session start and end time) for the previous days as the strategy analyzer does it?

          I know once the day starts and its reading in todays data, i would assume it forms those bars in acordance with the session start and stop.. i'm more interested in the historical bars that are populating my indicators already from the previous days... Because even a slight difference in the way its forming those bars can have drastic changes in how the strategy performs....

          What i'm asking is probably done corretly, its just after testing several strategies and seeing how just chnaging the session end or start by 1 minute can produce very different results, need to be certain that when its run in real time that its still producing bars the same way.. because a small change in the way it makes the bars fro the current day and for the previous days that are being used to make the real time decisions can cause problems...

          Comment


            #6
            I guess it all boils down to, will the strategy analyzer form the bars exactly the same way using the session start and end time as the real time trading section does it...

            I'm fairly certain that new data comming in the bars will be formed using that session start and end time the same way.. the main concern is for the few days of historical data that the real time strategy is depending on to form the indicators at that moment in time...

            Comment


              #7
              They are formed in the same way. Historical data on a chart vs historical data in the Strategy Analyzer is the same. Indicators and strategies for both are calculated based off of what is on the chart. From a historical stand point, Strategy Analyzer and Chart will behave the same. Differences arise in real-time when real-time conditions diverge from backtesting conditions. This is expected behavior.

              For your concerns, they will be the same. If you set the same session begin/end times you don't need to worry about this.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Frostengine, I am going through the exactly same mental process. I haven't yet convinced myself one way or another.

                One thing I have learned, make sure on your strategy backtesting that you aren't buying and selling on the same bar. There is no way to know which order the OHLC came in, so it can produce a lot of false positives. You can search the trade results by # of bars and find that out.

                I have another somewhat similar thread going here:


                Perhaps we can help each other a bit, I am curious if you isolate your strategy backtest to one day at a time, then run the same strategy with the same params using Market Replay feature on that day, and share your results. You can see my explanation of results in the thread above.

                I have noticed that if my backtest results say only 2-3 trades a day, I am in fact making twice to three times that many in Market Replay mode.

                I've also noticed that the percentages/success ratio in backtest vs. market replay varies wildly. So, at least for the time being until I better understand why this is occuring or get some answers from NT, I am using backtesting only to 'narrow down' a rough set of params, then using as much Market Replay data as I can stand to sit through manually, one day at a time, to see how it would have really played out.

                Hope my comments help!

                Mike

                Comment


                  #9
                  ctrlbrk,

                  Backtesting and market replay and real-time are 3 completely different scenarios each with their own characteristics. Market Replay can be considered more characteristic of real-time, but even then there are a whole host of real-time issues that can never be simulated. Just to name a few, exchange delays, market fill conditions, etc.
                  Josh P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

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