My strategy uses unmanaged approach and I am getting the following error when changing the stopOrders:
Error 1 for Short Positions: Sim101, Stop price can't be changed below the market affected Order: BuyToCover 1 StopMarket @ 11,599
Error 2 for Long Positions: Sim101 Stop price can't be changed above the market, affected Order: Sell 1 StopMarket @ 11,599.50.
I tested the trail stop losses in ATM strategies and realized that these errors almost never occur when using the ATM strategies.
I need to know how I code my script so that I can catch these errors and and safely submit the change orders without it crashing my strategies and my hopes.
Thanks,
Comment