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: Searching around, I also found this error reported with a couple of other strategies (
here and
here). Seems to always be an issue when closing using "netting" order, and immediately entering new trade.