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

analyzer and playback

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

    analyzer and playback

    Hi, can it be possible that the strategy to be implemented in the analyzer should be different for the one in playback? And I'm talking about the part in which for example I send an order, I know that for ex the state in one is always historical and in the other no. But I've tested a strategy in playback and it works perfectly, then i try to do it in the analyzer and It start to use the wrong stop loss and take profit, sometimes it doesn't even start, other times it starts. Can it be a problem in the strategy or it's something that has happened before? (It's an unmanaged strategy)

    #2
    Hello AlessioCianini12,

    You should expect that a strategy running real-time (live brokerage account, live market simulation, Market Replay in the Playback Connection etc...) will produce different results than the performance results generated during a backtest. This difference may be more easily seen on certain Bars types (e.g. Point and Figure, Renko) than others due to their inherent nature in bar formation.

    During a backtest you can select conservative or liberal fill algorithms which will produce different results. Fills are determined based on 4 data points, OHLC of a bar since that is the only information that is known during a backtest 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 it sounds like you're aware of that limitation.

    Also, here is a link to the differences on real-time vs backtest (historical).
    http://ninjatrader.com/support/helpG...ime_vs_bac.htm

    Adding intra-bar granularity can help with this.

    Intra-bar granularity adds a second data series such as a 1 tick series so that the strategy has finer granularity in the historical data in between the OHLC of the primary series. This allows for more accurate trades by supplying the correct price at the correct time for the order to fill with.

    In NinjaTrader 8, there have been two new enhancements so that programmers do not have to manually add this secondary series and code the script to for high accuracy fills (Order Fill Resolution) and for intra-bar actions (TickReplay).

    Here is a link to our forums that goes into depth on using Order Fill Resolution and Tick Replay to ensure your backtests are as close to real time results as possible:

    https://ninjatrader.com/support/foru...mance?t=102504

    High Fill Order Resolution and TickReplay cannot be used together. If it is necessary to have both, it is still possible to add intra-bar granularity to a script in the code itself for order fill accuracy and use TickReplay to update indicators with Calculate set to OnPriceChange or OnEachTick historically.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by sugalt, 04-30-2024, 04:02 AM
    2 responses
    13 views
    0 likes
    Last Post sugalt
    by sugalt
     
    Started by merc410, Today, 03:41 AM
    0 responses
    3 views
    0 likes
    Last Post merc410
    by merc410
     
    Started by Ndakotan1313, 03-14-2024, 05:02 PM
    2 responses
    60 views
    0 likes
    Last Post blaise_code  
    Started by claxxical, 05-30-2017, 12:30 PM
    37 responses
    4,457 views
    0 likes
    Last Post Padan
    by Padan
     
    Started by SugarDefwebsite, Today, 02:18 AM
    0 responses
    4 views
    0 likes
    Last Post SugarDefwebsite  
    Working...
    X