I am looking for a way to gracefully handle the error "Sell stop or sell stop limit orders can't be placed above the market" from within a NinjaScript strategy. The following forum threads are on topic but none suggests a way to programmatically handle the situation when an order is rejected for the above reason:
I currently have the parameter RealtimeErrorHandling set to RealtimeErrorHandling.StopCancelClose but I'm wondering if an alternate way of capturing errors (like the one above) is possible that can execute alternate code instead of having the strategy disable itself? For example, if an attempted sell stop limit order were rejected due to a fast-moving market then I would like to be able to submit a market sell order in its place. Can this be done within a NinjaScript strategy in such a way that the strategy remains enabled?

Comment