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

Error on backtest

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

    Error on backtest

    Hi, when i run a simulation on the analyzer and on the playback the strategy gives me different result and does not do what it's supposed to do when i use the analyzer. If i check the playback it's all correct, so i don't understand what is the problem. Also when i run the analyzer and i choose a period in which to run the backtest when i check the data of the exectuted trade they are outside of the time window that i selected. As shown in the pictures
    Attached Files

    #2
    Hello AlessioCianini12,

    Thanks for your post.

    I see in your screenshots that you are connected to the Playback connection while running a backtest on a strategy in the Strategy Analyzer.

    Before running a backtest on a strategy in the Strategy Analyzer you should ensure that you are NOT connected to the Playback connection as that could skew Strategy Analyzer results.

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

    It is expected that 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.

    See this 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
      Thanks for answering. The thing is that I'm not using the strategy with the attached data series, by this i mean that i always import a volumetric data series of 1 tick resolution and then i do my calculation when barsinprogess =1, that means i don't care which is the data series in which i attached the strategy cause i'm always importing the 1 tick resolution. Btw said so i still have differences between the analyzer and the playback. thanks.

      Comment


        #4
        Hello AlessioCianini12,

        It is usually expected to have some sort of differences between real-time tests in Playback and historical tests in the Strategy Analyzer.

        See this forum post for more information regarding this as well as the RealtimeReplayHistoricalComparisonExample script: https://ninjatrader.com/support/foru...ay-performance

        Let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by AaronKoRn, Today, 09:49 PM
        0 responses
        11 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Today, 08:42 PM
        0 responses
        10 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Today, 07:51 PM
        0 responses
        11 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,980 views
        3 likes
        Last Post jhudas88  
        Started by rbeckmann05, Today, 06:48 PM
        0 responses
        9 views
        0 likes
        Last Post rbeckmann05  
        Working...
        X