I have a custom strategy, which in some scenarios can close an existing trade and open in the reverse direction. For example, close an existing long and open a short.
The close is using market close using "netting" order (i.e. NetQtyFlag="Y"). It is for a FIFO account.
In some case, the new trade (i.e. the one after the close) fails to open. I get the following error:
"The account is locked. Trading is not available."
I have no idea what causes this. The strategy seems to recover from this, and later trades work again.
The strategy works ok on back-tester. Could the use of netting order to close all positions somehow prevent the new open order for working?
(PS: Sorry if this is a duplicate post, the forum locked-me out during posting the 1st time, and I'm not sure if it was submitted or not. You may delete the duplicate).