Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtesting Discrepancies

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

    Backtesting Discrepancies

    I've been backtesting a strategy with the Market Replay Connection for approximately 3 weeks. I've noticed that the same strategy may give different results. So I'm concerned that I'm not using Ninjatrader properly to run iterative script changes.

    Here is how I've been iteratively testing changes to my script:

    - Run the strategy
    - Like the results, so save the .cs file in another directory (as a backup --- e.g., copy and paste the .cs file in an alternate file system folder).
    - Make changes to the strategy from within Ninjatrader (using Tools -> Edit Ninjascript -> Strategy...)
    - Recompile the script (with F5), and rewind the market replay connection
    - Remove and re-add the strategies on the Strategies tab
    - Rerun the strategy
    - Don't like the results. So close the strategy editor in Ninjatrader, and copy over the new .cs file with the backup .cs file directly in the filesystem folder.
    - Reopen the strategy editor to confirm that the new strategy is loaded. Type a period in the script and delete it, and then recompile the strategy to make sure that it's loaded.
    - Remove and re-add the strategies on the Strategies tab. Also, rewind the market replay connection
    - Rerun the strategy

    My results differ -- which I expect. But sometimes, it's significant ($100+). Should that be expected?

    Also, if I delete the cache under Ninjatrader 7\db\cache, restart Ninjatrader, and rerun; the results are also significantly different (in the order of several $100's). In this scenario, some instruments don't even have trades executed when previously, trades were executed frequently. If I rewind the market replay connection and rerun the strategy, the trades fire. But what just happened, lol?

    What is the right way to run iterative backtests while tweaking a strategy file? Should I delete the cache and restart Ninjatrader everytime? I'm very concerned that the results aren't mimicking what I'd get in real time. I'm running NT 64-bit 7.0.1000.27, and using backtesting data downloaded from marketreplay.net and marketreplaydata.com. I'm using Forex pairs.

    I have the simulator set to enforce immediate fills, and to immediately submit live historical orders. I always replay the market replay connection from the same day/time.

    If you need anymore information, please let me know. Thanks for your feedback.

    #2
    Hello,

    Thank you for the question.

    The way you are doing the process seems correct. Can you provide a simplified example script that demonstrates this so I can test this on my end to see if this is something with your installation or the logic being used?

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

    Comment


      #3
      Great -- I'm glad it sounds correct. When I'm out of the weeds of this testing, I'll try to send a sample!!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by wzgy0920, 04-20-2024, 06:09 PM
      2 responses
      26 views
      0 likes
      Last Post wzgy0920  
      Started by wzgy0920, 02-22-2024, 01:11 AM
      5 responses
      32 views
      0 likes
      Last Post wzgy0920  
      Started by wzgy0920, Yesterday, 09:53 PM
      2 responses
      49 views
      0 likes
      Last Post wzgy0920  
      Started by Kensonprib, 04-28-2021, 10:11 AM
      5 responses
      191 views
      0 likes
      Last Post Hasadafa  
      Started by GussJ, 03-04-2020, 03:11 PM
      11 responses
      3,230 views
      0 likes
      Last Post xiinteractive  
      Working...
      X