Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Testing on historical data

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

    Testing on historical data

    Hi, I'm writing a strategy, and I'm entering my positions based on a condition that I'm evaluation on the first tick of a candle. The problem is that when I'm enabling my strategy, the orders placed in the historical data are placed on the next candle. I've read quite a bit to see how to overcome this, and I saw that this is the way it actually works, and that I would need to add a new dataseries of 1 tick, and place the order to that dataseries.

    What am I missing here?

    Thanks in advance

    #2
    Hello mchanu,

    In historical the Calculate setting is forced to OnBarClose unless TickReplay is enabled.

    If an order is submitted after the bar has closed, it fills at the open of the new bar.

    TickReplay cannot be used for order fill prices.

    This means to submit and fill orders intra-bar (before the bar closes) 1-tick intra-bar granularity must be implemented, TickReplay must be enabled, Calculate must be set to OnPriceChange (or OnEachTick if the script is collecting volume or counting ticks).

    Below is a link to a support article that provides direction.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea, thanks so much for your response.
      I'm facing a couple of challenges to follow this.
      If I add the second series as suggested, then it seems Order Fill resolution can't be used. I'm already using the enterLong/Short with the reference to the data series added (tick). This would be the first hurdle to overcome and I need your guidance please.
      The second one is, if I can make the the strategy with the tick data series work, what I don't know how to make it work is to set profit or set stoploss methods, as this are not overloaded with a data series parameter. Do I need to change the approach completely? (managed with advanced approach, or unmanaged approach?

      Comment


        #4
        Hello mchanu,

        "If I add the second series as suggested, then it seems Order Fill resolution can't be used."

        This is correct. Adding a 1-tick series for intra-bar granularity replaces Order Fill Resolution.

        The 1-tick series is added for a 1 tick resolution of order fills.


        "what I don't know how to make it work is to set profit or set stoploss methods, as this are not overloaded with a data series parameter."

        From the article I have linked in my previous post:

        "Note on Set methods
        Set methods such as SetStopLoss, SetTrailStop, SetProfitTarget, are submitted to the primary series only.
        Neither intra-bar granularity nor order fill resolution will allow a 1 tick series to update or fill these orders.
        For the managed approach, use Exit orders such as ExitLongStopMarket() and ExitLongLimit() instead of set methods for order fill resolution to apply.​"

        I highly recommend reviewing this article.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        49 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        67 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X