Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy completability for historical and live trading

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

    Strategy completability for historical and live trading

    Hi!
    So probably asked multiple times, but I have been trying to get the proper answer for couple of days and unfortunately I didn't made it.

    I've been reading some documentation and notes about the platform and the capabilities and made bunch of experiments before opening this thread. it seems like its a well known issue with the orders execution and filling logic differences but I want to tackle it the best as I can.

    So my strategy logic supposed to execute the order action at the begging of a new bar (first or second tick, doesn't too crucial) by looking on the previous 5 bars that was completed (5 min chart), and if the condition is made, execute the order as soon as possible and fill it.
    So for live trading the task is pretty much straight forward, at the onBarUpdate function of my new forming bar, I'm just looking at the close array (just for example) of the previous bars (Close[1], Close[...] ) and sending an enter order (without limit).

    The problem with the same logic in historical filling is that I'm in a "bar late" because I'm executing the order at the right spot, but its only been filling in the start of the next bar and not the next tick (or price change) and this gives me big price differences that hurts the historical statistics very badly.

    I overcome (kind of) this problem in a historical perspective by executing the order at the close of the previous bar, and than its being filled in the begging of the next one (as it should) but with the gap between close and open.

    I've tried to implement with AddDataSeries(Data.BarsPeriodType.Tick, 1); and all the corresponding functionally described here : https://ninjatrader.com/support/help...ipt_strate.htm but still i can see that in history perspective the filling occurs only at the next bar. (and also have Calculate.OnEachTick defined.)

    There is any way that I will be able to mitigate this issue at the same strategy file? meanwhile my plan was having one strategy only for backtesting and one for live trading.


    Thanks in advance!

    #2
    Hello EnullByte,

    If you are trying to test a strategy that needs to submit an order after the bar opens you would need to test that in realtime where you can use OnEachTick processing. In historical the bars are processe OnBarClose so you would only be able to simulate that by using a secondary 1 tick series. Because the primary bars are used to associate where the fill will be displayed it will always be on the following bar in a backtest. I would suggest using the playback connection to test this type of strategy so you can play realtime data forward to allow it to work like it would in realtime.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    54 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    131 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    73 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X