Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Filling Order on Open of Bar[0] when using Strategy Analyzer

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

    Filling Order on Open of Bar[0] when using Strategy Analyzer

    I have a strategy that enters a trade based on a Moving Average calculated using the Open price. So when the entry condition is met the order can be placed at the opening of the bar. This seems to work fine when I run the strategy using the live data, but when I run it using Strategy Analyzer the entry doesn't occur till the next bar, I'm using 2min bars so as you can imagine it throws off the results quite a bit. I have set the strategy to calculate on each tick, which means each tick is a new open/close if I understand correctly. I appreciate any assistance, I am new to NinjaTrader and am just feeling my way through it.

    #2
    Hello jhjhawkins,

    Welcome to the NinjaTrader forums!

    Market orders appear at the open of the next bar when submitted after closes. This would be the case if Calculate is OnBarClose in real-time or when in historical data without using intra-bar granularity and TickReplay.

    Please review the post below with details.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      It makes sense to me if the indicator is calculated OnBarClose, but if it is calculated OnBarOpen shouldn't the order fill at some point on that bar if the conditions are met?

      Comment


        #4
        Hello jhjhawkins,

        Thanks for your reply.

        With your strategy set to Calculate.OnEachTick, with live data you will get an order fill intrabar.

        When you apply your strategy to historical data (either on the chart or in the strategy analyzer) then the strategy will only perform as if it has been set to calculate.OnBarClose. The reason for this is that historical bars do not have all of the ticks that built the bar, there would be only one tick and the bar will provide the OHLC values of the bar. this is why historical process occurs so quickly.

        To see intrabar entry fill performance in the strategy analyzer, you would need to add a 1 tick series to your strategy and enable tick replay. The 1 tick series would be for the order fills and Tick Replay is needed for your code to process on each tick.

        Reference: https://ninjatrader.com/support/help...ick_replay.htm

        Please see this example: https://ninjatrader.com/support/help...ipt_strate.htm

        Alternately, you can test your strategy without modification by using PlayBack with Market replay data. this would be a much slower but thorough means of backtesting, please see: https://ninjatrader.com/support/help...connection.htm

        Comment


          #5
          Paul
          Thank you very much, this makes sense, now just need to spend some time figuring it out.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Yesterday, 05:17 AM
          0 responses
          56 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          132 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
          45 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