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

Market Replay vs BackTest

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

    Market Replay vs BackTest

    I know I have gone down this road before, but I like having deja vu
    why does the back test on same strategy ( 5 days) same parameters
    have completely different results when running a downloaded market replay of the same week ?
    which do I trust the backtest allways ( showing me insane % profits, the replay showing me losses ?)
    thanks
    O

    #2
    Hello obwon1,

    Thanks for your post.

    Please review the help guide document on the differences on real-time vs backtest (historical).
    http://ninjatrader.com/support/helpG...ime_vs_bac.htm

    A strategy running real-time (live brokerage account, live market simulation, Playback connection etc...) will produce different results than the performance results generated during a backtest.

    When in historical data, only the Open, High, Low, and Close will be available and there will be no intra-bar data. This means actions cannot happen intra-bar, fills cannot happen intra-bar. All prices and actions come from and occur when the bar closes as this is all the information that is known.

    Because of this, OnBarUpdate will only update 'On bar close' as it does not have the intra-bar information necessary for 'On price change' or 'On each tick' and the script will not have the intra-bar information to accurately fill an order at the exact price and time.

    Below is a link to the help guide on Calculate.
    https://ninjatrader.com/support/help.../calculate.htm

    To improve the accuracy of a backtest, you may use Tick Replay along with an added 1-tick series to have logic processed intra-bar and have orders filled intrabar.
    Tick Replay would be used to have the logic process OnEachTick or OnPriceChange with historical data, but this does not allow for intra-bar order fills. You would need to add a single tick data series and submit orders to that single tick data series for a strategy that uses Tick Replay.

    High Order Fill Resolution allows for intra-bar order fills with historical processing, but is not compatible with Tick Replay.

    Please reference the SampleIntrabarBacktest example and the following Help Guide links for more information.

    SampleIntrabarBacktest 'Backtesting NinjaScript Strategies with an intrabar granularity' - https://ninjatrader.com/support/helpGuides/nt8/backtesting_ninjascript_strate.htm

    TickReplay — https://ninjatrader.com/support/help...ick_replay.htm

    Developing for Tick Replay -
    https://ninjatrader.com/support/helpGuides/nt8/developing_for__tick_replay.htm?zoom_highlightsub= developing+for+tick+replay

    Additional information may be found in this NinjaTrader Forum post —
    https://ninjatrader.com/support/foru...mance?t=102504

    Please let us know if we may be of further assistance to you.​
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      to summarize would it be safe to say that it is more accurate to run market replay after downloading the current data or letting ones strategy run in real time in a sim account ?

      Comment


        #4
        and the other item I dont fully get is wether to set my strategy to on tick or price change ?

        Comment


          #5
          Hello obwon1,

          Thanks for your note.

          Yes, it would be more accurate to test your strategy using the Playback connection with Market Replay data.

          The Calculate mode you run your strategy with would depend on how you want the strategy to process logic. If you want the strategy to calculate logic at the close of each bar, you would use Calculate.OnBarClose. If you want your strategy to process logic for each change in price, you would use Calculate.OnPriceChange. If your strategy requires processing each tick that occurs or you want your strategy to process logic for each incoming tick, you would use Calculate.OnEachTick.

          See this help guide page for more information about Calculate: https://ninjatrader.com/support/help.../calculate.htm

          Let me know if I may assist further.
          Brandon H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Haiasi, 04-25-2024, 06:53 PM
          2 responses
          17 views
          0 likes
          Last Post Massinisa  
          Started by Creamers, Today, 05:32 AM
          0 responses
          5 views
          0 likes
          Last Post Creamers  
          Started by Segwin, 05-07-2018, 02:15 PM
          12 responses
          1,786 views
          0 likes
          Last Post Leafcutter  
          Started by poplagelu, Today, 05:00 AM
          0 responses
          3 views
          0 likes
          Last Post poplagelu  
          Started by fx.practic, 10-15-2013, 12:53 AM
          5 responses
          5,408 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Working...
          X