• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.


No announcement yet.

Partner 728x90


How can I speed up Playback backtesting of strategy?

  • Filter
  • Time
  • Show
Clear All
new posts

    How can I speed up Playback backtesting of strategy?

    How can I speed up Playback backtesting of strategy?
    It takes forever to run my strategy for 1 year and I need at least multiple years at least.

    On Set up, I'm using "On bar close" over "On each tick" and "On Price Change".
    Historical fill processing: Standard (Fastest)

    What else can I do?

    Is the anything else I could do to speed up the process and run playback at its fastest?
    I am willing to sacrifice accuracy.

    How slow is it? What replay speed ate you using?

    depending on strategy, I can replay 4 years of ES data in 11 to 13 hours c then it slows down and ends up using 1 thread too heavily and no other cpu.


      At max speed.


        Hello johnnybegoode,

        Thanks for your post.

        Setting Calculate.OnBarClose would be the only setting that would be used to throttle performance in Playback unless the strategy offers some of its own settings to control its performance. Historical Fill Processing will not matter in this situation because the order fills are being simulated from the streamed "realtime" data that comes from the Playback Connection.

        You could enable the strategy from the Control Center to test in a leaner environment which could yield faster results since the only thing that would be processed is the strategy. Anything else would depend upon how efficient the strategy code is written and how complex it is.

        Strategies are also run against a single instrument thread when in realtime mode, so we cannot expect the same multi-threading benefits as seen from Historical Processing (from a thread pool.)

        I've included some Best Practice tips for NinjaScripts which could help to speed up the script further.

        Best Practices (Performance Tips) - https://ninjatrader.com/support/help...tm#Performance

        Using the Strategy Analyzer to backtest will be significantly faster than using the Playback Connection and can better utilize multiple cores of your CPU. This will come at a cost for fill accuracy considering the differences between Realimte simulations and Historical simulations.

        Discrepancies between Realtime and backtest - https://ninjatrader.com/support/help...ime_vs_bac.htm

        Help guide information is publicly available.

        I look forward to being of further assistance.
        JimNinjaTrader Customer Service


          Originally posted by johnnybegoode View Post
          At max speed.
          How much data is processing at max speed?

          is it slower than nt7? How much cpu is being used?

          how many charts are open?

          how many strategies running?

          how many workspaces are open? You have to close everyone one except the one your running.


            How to make the strategy offers some of its own settings to control its performance?

            By control center, do you mean no chart involved? If that's the case, I'm already doing that.

            How do I multithread from historical processing from a thread pool?

            Strategy analyzer does not support multi instruments, right?

            I'm using Historical data, not Market Replay.

            My strategy has 2 instruments and 2 indicators and is testing in 1 second timeframe.

            How to find out how much data is processing at max speed?

            How to find out how much CPU and core it is using?

            I have 4 cores and is running NT8 64 bit

            I don't use NT7.

            I don't use charts and there is no plotting on my strategy.

            Just one workspace.
            Last edited by johnnybegoode; 01-09-2019, 06:59 PM.


              NinjaTrader_Jim has offered the best explanation [01-09-2019, 07:22 AM] I've seen thus far re: CPU Power/performance expectations one should have on PlayBack and how in actuality any performance benefit would be seen instead by using Strategy Analyzer. In essence, I've been seeking improved performance on PLAYBACK and as explained, it seems that more CPU's and threads will not do it. Only improved CPU GHz will do it (and that includes any overclocking) if so available. Thank you.



                Isn't it possible, via a setting at NT8, to increase the transmission bitrate of the Playback connection and get the best of both worlds?
                (1) Real Market data accuracy although recorded and not a historical data feed and
                (2) Backtesting more accurate by running the platform in forward mode with the recording.

                I was researching the topic and since Strategy Analyzer cannot run on Market Replay and NT8 needs a customization to look into intrabar granularity ( actual bid/ask data) , I think just increasing Market Replay data speed would address all problems at once. Isn't this available for NT8?

                Thanks much


                  Hello bouncetherubble,

                  Strategies can be tested against Market Replay data in the Playback Connection which will mimic realtime data. Orders are then filled with Bid/Ask data as opposed to the OHLC values of the data series as seen with historical processing. Market Replay data is more granular than historical data and takes more CPU resources to process.

                  Playback - https://ninjatrader.com/support/help...connection.htm

                  Discrepancies between realtime data and backtesting - https://ninjatrader.com/support/help...ime_vs_bac.htm

                  Please let us know if you have any additional questions.
                  JimNinjaTrader Customer Service



                    Thanks , I have just seen here (https://ninjatrader.com/support/help...connection.htm) that Replay speed is configurable. That was something I was already aware of and suffered a " memory loss" . Apologies for the empty question.




                      I just found out Strategies appear not to run on Market Replay. The Enable checkbox is grayed at Strategy Menus.

                      Is there anyway a Strategy can be run at Market Replay, so that, Results can be trusted in a higher degree than simply running the Strategy backtesting option?

                      Strategies cannot be enabled at Command Center , neither when Playback/ Market Replay ( radio button) or Playback? Historical ( radio button) are activated.

                      Thanks Much,


                        Hello bouncetherubble,

                        When testing strategies using the Playback Connection, the strategy must be enabled against the Playback101 account. When you connect to the Playback Connection, please add a new instance of your strategy and make sure it is assigned to the Playback101 account before enabling.

                        Please let me know if you are unable to enable the SampleMACrossover strategy against the Playback101 account when connected to the Playback Connection.
                        Attached Files
                        JimNinjaTrader Customer Service


                          Hi Jim

                          Thanks much, I will try that asap and get back.



                          Latest Posts


                          Topics Statistics Last Post
                          Started by stewarco, Today, 05:46 AM
                          1 response
                          Last Post NinjaTrader_Jermaine  
                          Started by andrewtrades, Yesterday, 08:24 PM
                          2 responses
                          Last Post NinjaTrader_ChristopherD  
                          Started by authenticx, Yesterday, 10:07 PM
                          1 response
                          Last Post NinjaTrader_PatrickG  
                          Started by jeronymite, Today, 05:11 AM
                          1 response
                          Last Post NinjaTrader_Jim  
                          Started by Harvard, Yesterday, 11:37 PM
                          1 response
                          Last Post NinjaTrader_PaulH