I have been running into issues with my strategy when my exit stop price is above the current market price (if long, or the opposite if short). This is a strategy based on end of day data, and so when I submit an order there can often be a large gap overnight.
I calculate the stop price based on the last close; for example, if the last price was $25, I might submit a stop of $24.50. This is a strategy based on end of day data, and so when I submit an order there can often be a large gap overnight that results in my intended stop price being above the current market price.
I submit a new stop price every day (to mimic a trailing stop, but submitted manually). Any time that I try to use tight stops though, I run into issues. I have scoured this forum, and spent a lot of time trying to program error handling in the OnOrderUpdate section, but nothing that I do seems to fix this issue.
What I am wondering is: How would I go about programming NinjaTrader such that if I try to submit a stop order that is above the current market price, it will just exit the position that I'm applying the stop to? (Rather than throw an error that aborts the strategy?)
Thanks

Comment