• 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


Live vs. Backtest Performance

  • Filter
  • Time
  • Show
Clear All
new posts

    Live vs. Backtest Performance

    I have found that strategies that perform well on backtest data are often drastically different (read very poor) in live market conditions. One source of the problem is the dynamic values of the indicators being calculated which may not be not an issue with historical data.

    What is the best way to mimic as close as possible the backtest results.? For instance is it better to implement a strategy On bar close, rather than On each tick/price change, in order to limit false fills in live markets? What other ways?

    Thanks for your help.

    Hello aaadetos,

    Thanks for opening the thread.

    As historical data is based on OHLC data, you can configure your NinjaScripts to Calculate.OnBarClose instead of OnEachTick to get results closer to what you are backtesting.

    As Realtime data is what we trade on with live accounts, it is good practice to write your strategy so its backtests are closer to the results that you receive in Realtime as opposed to the inverse.

    One way how you can improve back test accuracy is to submit orders to a 1 tick data series. You can also enable High Order fill resolution for backtesting single-series strategies against a 1 tick data series.

    Here is a sample strategy for back testing with intrabar granularity: http://ninjatrader.com/support/forum...ead.php?t=6652

    Historical Fill Processing: https://ninjatrader.com/support/help...ical_fill_.htm

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

    Please let me know if I may be of further assistance.
    JimNinjaTrader Customer Service


      Thanks Jim,
      Based on your post, would I be correct to expect that the performance results between back testing and live testing should be closest when testing directly on tick data, as opposed to different data series? Based on my testing, this seems to be the case.

      However, I do see that on tick data, slight differences still persist between using the standard vs high order fill resolutions (setting the high to a 1-tick granuarity). This can only mean that upon expiration of the say 150-tick bar, at the close of the bar (COBC ==true), the high order fill fills at the next available tick; but when does the standard order fill execute? I also expect it to fill intra-bar on the next bar after the bar close, since both order types are market orders; yet they are different, why?

      Thanks again.


        Hello aaadetos,

        Thanks for your additional questions.

        When using the Strategy Analyzer, using a single tick data series to place orders to (using High Order Fill Resolution, or with a multi series strategy,) will give you closer to actual results than standard fill resolution. Your testing is correct.

        Standard Fill Resolution will fill orders using three virtual bars that mimic the price movement of a bar. This would mean that a trade could fill on the same bar if the movement of the virtual bars allows the order to be filled.

        This can be best visualized in the Understanding Historical Fill Algorithm section of the help guide. Here is an example:
        1. Open price to the High price
        2. High price to the Low price
        3. Low price to the Close price


        You can also test your strategies against Market Replay Data, as well, if you wish to test your strategy against recorded market data that is the equivalent to real time data. You can read more about using Market Replay and the Playback connection here: https://ninjatrader.com/support/help...connection.htm

        If you have any additional questions, please don't hesitate to ask.
        JimNinjaTrader Customer Service


        Latest Posts


        Topics Statistics Last Post
        Started by mtamaku, Today, 10:34 AM
        0 responses
        Last Post mtamaku
        by mtamaku
        Started by pnamphi, Yesterday, 04:29 AM
        1 response
        Last Post NinjaTrader_ThomasC  
        Started by ralett, 02-12-2020, 12:11 PM
        2 responses
        Last Post trader333  
        Started by GKRuubster, Today, 06:22 AM
        0 responses
        Last Post GKRuubster  
        Started by Gerik, Today, 05:59 AM
        0 responses
        Last Post Gerik
        by Gerik