I just noticed on some strategies using ATM that when using AtmStrategyClose to cancel all orders and go flat it is not working as expected.
If the ATM has not yet a position it works fine, but if it has a position with targets and stops ( ie; no orderId active but atmstrategy id is active ) then AtmStrategyClose removes all orders but reverses position ?
I tried reducing my code to the minimun and adding a condition to exit if trade lasts for more than 3 bars ;
if(atmStrategyId.Length !=0 && orderId.Length == 0 && (CurrentBar-entrybar)>=3) AtmStrategyClose(atmStrategyId);
..and still the same, cancel orders, close position, start a new inverse and naked position...
Am I doing something wrong ?
Thanks !

Comment