What I suspect is happening is the following order is being submitted as an exit order when the short entry is executed:
SetStopLoss("Enter Short", [login to view URL], MiEMA[1], false);
The problem is likely that the value MiEMA[1] is lower than the market price, so the stop loss is being submitted to an invalid price and resulting in errors. You either need to modify the price used in SetStopLoss() or you need to remove this from your script and utilize your logic for ExitShortStopMarket():
slOrderShort = ExitShortStopMarket(0, true, quantity, stopLevel, "Stop Short", "Enter Short");
You can't use both types of exits for the same position.
I will share the file over chat. Thank you
With a keen eye for detail and problem-solving skills sharpened by my expertise in C Programming and C++ Programming, I'm confident in my ability to address the issue you're facing with Ninjatrader 8.
I hope this message finds you well. As a skilled programmer, I have a proven track record of creating high-quality software solutions. I'm reaching out to offer my professional programming services to you.