I wanted to add a broker-side catastrophic stop-loss to my automated ninja strategy. Generally, I manage the stops synthetically from my script, but i wanted to get a stop loss order on the broker as well in case i lost connections or something else terrible happened.
I use MBTrading -- the fact that MB does not support OCO orders has made this very difficult. In order to achieve this, I have used advanced order management within my strategy to place an EnterLongStop() with the broker when the initial order is filled. Up to this part, it works great....
Here is where it gets tricky -- When my strategy is performing a normal trade exit, it uses "ExitLong()". Unfortunately, if there is a live stopOrder MB Trading will reject the exitLong order. So, I decided to call CancelOrder on the stop order and then immediately call ExitLong(). Unfortunately, when running live it seems that the cancel does not process quickly enough, and the ExitLong() is not accepted by MBTrading (complains I am "trying to go short").
So, I am wondering -- what would happen if, rather than canceling and using an ExitLong, I just updated the stop value to the current bar Close[0] price? In effect, using the live stopOrder to force an exit? Seems logical, but what would happen if the Close[0] price is already above the current stock price? Will the broker accept a stop price update that triggers an automatic exit, or would they reject that update?
If that strategy won't work, might you have any ideas how i could get either the original strategy above to work, or any alternative approaches I might be able to use?
Thanks for your help,
Brandon
Comment