Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

synthetically build bars of a higher timeframe / CalculateOnBarClose = true

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

    synthetically build bars of a higher timeframe / CalculateOnBarClose = true

    NT support,

    Is there a way to synthetically build bars of a higher timeframe to properly simulate CalculateOnBarClose = false in a backtest?

    Given that running a strategy in backtest where CalculateOnBarClose is always equal to false can give very different results to running a strategy with CalculateOnBarClose = false. For example, if one was to run a strategy with 1 min bars as a lower timeframe with 60 min bars as a signally timeframe.

    I’ve read the documentation on multi-time frame strategies and have worked with it for sometime; I understand the principle of look back in backtest and percent complete in real time. I’m wondering is there another method on simulate this in backtest.

    Thanks and regards,

    drolles

    #2
    Hello,

    The only way to do this is to Add() in a 1 tick series bars. This is the only way to do tick by tick backtesting to simulate COBC=False.

    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Hello,

      Or run your tests forward on Market replay if you build up enough market replay data.

      Let me know if I can be of further assistance.
      BrettNinjaTrader Product Management

      Comment


        #4
        Brett,

        Thanks very much for your prompt and concise reply.

        Just want to check that I’ve understood, if I just import Tick as an additional timeframe NT will automatically realise that it has the ability to operate with COBC = false? Or are you saying that I need to do something additional?

        Thanks and regards,

        drolles

        Comment


          #5
          Hello,

          It will still technically run COBC = true. Just you simply have all the datapoints. This simulated a COBC = false running mode.

          For example lets say I want to run a backtest COBC = False on 5 minute AAPL.

          I then ADD() a 1 tick series.

          I know run COBC = true on the added 1 tick series.

          This simulated COBC = False on the 5 min bars since your calculating on every tick.

          Let me know if I can be of further assistance.
          BrettNinjaTrader Product Management

          Comment


            #6
            Brett,

            Thanks very much for your help on this.

            I’ve had a bit of a think on this over the weekend and reread the documentation. I just want to make sure I’ve really understood.

            You are saying that when we have tick data for the strategy behaves like in Figure 2 (Under “How Bar Data is Referenced”) in the documentation here: http://www.ninjatrader.com/support/helpGuides/nt7/index.html?multi_time_frame__instruments.htm? Is that any tick data for example if we roll it up to 10 ticks or does it have to be single tick only?

            The documentation here discusses historical bars quite specifically that appears to be at odds with your explanation? See paragraph under the sub-heading – A quick example to illustrate the point:

            Thanks and regards,

            drolles

            Comment


              #7
              Hello,

              When you add Tick data is it a single tick. WHen you run your code on tick data it does not matter on COBC since its a single tick and the calc is run on each tick.


              TICK COBC=true TICK COBC=true TICK COBC=true TICK COBC=true

              TICK COBC=false TICK COBC=false TICK COBC=false TICK COBC=false


              This is the sequence of events on a tick by tick run on data between the two. As you can see te calculations occur at the same time. This is only a tick chart however as you have read there are differences on larger time frame charts such as you need to account for if your Calculations for the bar come before or after the tick based on if your using COBC = true or false.

              Let me know if I can be of further assistance.
              BrettNinjaTrader Product Management

              Comment


                #8
                Brett,

                To clarify further, wouldnt the data series selected in the Strategy Analyzer also have to be 1 tick in order have that granularity during testing, to be as close to market conditions as practical?

                Jon
                Attached Files

                Comment


                  #9
                  Hello,

                  Yes this is correct in the backtester. Or use multi series programming and print in a secondary series of 1 tick.
                  BrettNinjaTrader Product Management

                  Comment


                    #10
                    Think about it this way. What does CalculateOnBarClose = false mean? It means calculate on every tick. As in any one tick, open=close=high=low, that means that in effect using a 1 tick timeframe IS processing every tick, which is exactly what COBC = false does.

                    Thus calculating on 10 ticks would just mean that you are calculating on a 10tick timeframe with CalculateOnBarClose = true.

                    Comment


                      #11
                      All,

                      Thanks for the input.

                      So we are saying that this can’t be simulated with anything other than 1 tick data? For example, we can’t proxy market action by using a lower timeframe of 1 min bars building 60 mins bars? It can only be one using 1 tick data?

                      Thanks and regards,

                      drolles

                      Comment


                        #12
                        How data bar is referenced

                        Hello, I struggle with StrategyAnalyzer and huge essential differences between result of StrategyAnalyzer and MarketReplay.

                        I've read http://www.ninjatrader.com/support/h...nstruments.htm

                        "How data bar is referenced".

                        And - in a pictures and text is written: "The 1 minute bars in yellow will know the current OHLCV of the 3 minute bar in yellow (2nd 3 minute bar) which is still in formation...not yet closed."

                        This bring inaccuracy into result of backtest and essential difference with MarketReplay and real.
                        Could you correct this and generate Close of 3 min after close 3rd - 1 minute close - similar to real time bar processing?

                        I understand, that this is not possible in some cases, if strategy have 7 minute and 9 minute dataseries, there aren't common Close event.
                        But If a strategy has multitime strategy with 1 minute, 10 and 30 minute dataseries, then 10 and 30 minute dataseries can fire OnBarUpdate event on Close of 10th and 30th minute.

                        Comment


                          #13
                          Hello,

                          This is intended design and spec and is also mentioned in the help guide. There will always be small differences between strategy analyzer backtests and running live due to the nature of how live works vs in historical. You understanding of why its not possible in some cases and this and some other reasons where the reasons this is intended design.

                          I will contact my product developer however and get this added to suggestion list to possibly add in a future version of the software. Thank You for posting this to make NinjaTrader better.
                          BrettNinjaTrader Product Management

                          Comment

                          Latest Posts

                          Collapse

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