I have two Long Positions of the same instrument in NinjaTrader. I can see this in the Positions tab of NinjaTrader. The reason, why there are two positions, is unclear form me anyhow.
I use the following code to exit the long position:
"targetOrder = ExitLongLimit(0, true, 1, LongExitLimit, "myLongExit", "myLongEntry");"
In my strategy, I use in OnStateChange also
"IsAdoptAccountPositionAware = true;
StartBehavior = StartBehavior.AdoptAccountPosition;"
Unfortunately, I get the error message in the NinjaScript Output with the reason "This was an exit order but no position exists to exit'.
What did I do wrong?
Kind you
Gerik
Comment