Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error: PlaceOrder: entry execution for existing position missing

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

    Error: PlaceOrder: entry execution for existing position missing

    I have a strategy that was working fine in live data but fails in Playback data. It is a strategy that only swaps from long to short and always has a stop loss, so it is always in a position. Also, for the reverse position code I make sure that the Exit*() finishes by testing in OnOrderUpdate that the contract count for the order and for the stop loss has gone to zero, only then do I submit another SetStopLoss() and Enter*() in the opposite direction. So it should be back to a flat position when I enter again. What does this error message mean? Thanks for any help. See image:
    Click image for larger version

Name:	Screen Shot 2022-11-12 at 9.25.29 PM.png
Views:	159
Size:	445.7 KB
ID:	1223308

    #2
    To fix this I simplified things a bit and made the SetStopLoss() call once in OnStateChange(), changing it from using a calculated Price to simply a Ticks offset. That still didn't fix it. But moving the Enter*() call from OnOrderUpdate to OnBarUpdate right after the call to Exit*() seems to have done the trick. I'll try it out again on live data when the futures open up again. It seems to be working now with Playback data.​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    51 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X