Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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:	104
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 futtrader, 04-21-2024, 01:50 AM
    6 responses
    57 views
    0 likes
    Last Post futtrader  
    Started by sgordet, Today, 11:48 AM
    0 responses
    1 view
    0 likes
    Last Post sgordet
    by sgordet
     
    Started by Trader146, Today, 11:41 AM
    0 responses
    2 views
    0 likes
    Last Post Trader146  
    Started by jpapa, 04-23-2024, 07:22 AM
    2 responses
    17 views
    0 likes
    Last Post rene69851  
    Started by funk10101, Today, 11:35 AM
    0 responses
    1 view
    0 likes
    Last Post funk10101  
    Working...
    X