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

Live vs. Backtest Performance

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

    Live vs. Backtest Performance

    Hello,
    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.

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

    Comment


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

      Comment


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

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kujista, Today, 06:23 AM
        0 responses
        1 view
        0 likes
        Last Post kujista
        by kujista
         
        Started by traderqz, Yesterday, 04:32 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by f.saeidi, Today, 05:56 AM
        1 response
        5 views
        0 likes
        Last Post Jltarrau  
        Started by Jltarrau, Today, 05:57 AM
        0 responses
        5 views
        0 likes
        Last Post Jltarrau  
        Started by Stanfillirenfro, Yesterday, 09:19 AM
        7 responses
        53 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X