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 can I speed up Playback backtesting of strategy?

Collapse
X
 
  • 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.

    #2
    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.

    Comment


      #3
      At max speed.

      Comment


        #4
        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

        Comment


          #5
          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.

          Comment


            #6
            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.

            Comment


              #7
              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.

              Comment


                #8
                Hi

                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
                G

                Comment


                  #9
                  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

                  Comment


                    #10
                    Jim,

                    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.

                    Best
                    G

                    Comment


                      #11
                      HI,

                      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,
                      G

                      Comment


                        #12
                        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

                        Comment


                          #13
                          Hi Jim

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

                          Best
                          George

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by maybeimnotrader, Yesterday, 05:46 PM
                          3 responses
                          23 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by adeelshahzad, Today, 03:54 AM
                          5 responses
                          32 views
                          0 likes
                          Last Post NinjaTrader_BrandonH  
                          Started by stafe, 04-15-2024, 08:34 PM
                          7 responses
                          32 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by merzo, 06-25-2023, 02:19 AM
                          10 responses
                          823 views
                          1 like
                          Last Post NinjaTrader_ChristopherJ  
                          Started by frankthearm, Today, 09:08 AM
                          5 responses
                          23 views
                          0 likes
                          Last Post NinjaTrader_Clayton  
                          Working...
                          X