Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot Executions is on Wrong bar

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

    Plot Executions is on Wrong bar


    I've got a strategy running on a chart. I noticed that when I plot the executions that the executions are being plotted one-bar after the one I expect. Just wanted to check if this is normal or if there's a glitch in my code. I've attached a screenshot of an example. I expect to go long on the close of the bar before the entry bar thats plotted and exit on the bar before the exit bar that's plotted.

    #2
    Hello kevinenergy,

    Thanks for your post.

    This behavior would be expected when we are calculating a strategy with Calculate.OnBarClose. Let's take a look at the SampleMACrossover strategy. A cross occurs and the next bar calculates the crossover and submits an order. The next bar after that then shows the execution marker.

    Click image for larger version

Name:	NinjaTrader_2018-10-22_11-33-38.png
Views:	297
Size:	6.4 KB
ID:	1036752

    Testing with Calculate.OnEachTick/OnPriceChange, we can see that a cross can occur, an order can be submitted and the execution can be plotted all on the same bar. I used Tick Replay to be able to run the strategy historically using Calculate.OnEachTick/OnPriceChange.

    Click image for larger version

Name:	NinjaTrader_2018-10-22_11-38-36.png
Views:	271
Size:	4.9 KB
ID:	1036753

    Please let us know if you have any additional questions.

    Comment


      #3
      Thanks for clarifying Jim. Guess it makes sense since things are actually happening on the open of the next bar.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      90 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      136 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      120 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      69 views
      0 likes
      Last Post PaulMohn  
      Working...
      X