We are backtesting one Strategy in which we want to trade more than one stock, and we are facing the following issue:
1) --> The Strategy enters Long in stock 1 (LMFA) on the following instant: 26/01/2018 14:30:00 CurrentBar: 2 BarsInProgress: 0 Instrument: LMFA
When we receive information that entry order was executed, we set the stop loss and take profit orders and we link both to the entry order (EnterLongLMFA2)
2) --> The Stop Loss is activated for LMFA stock and Profit Target is cancelled. So far this behaviour is OK.
3) --> The Strategy tries to enter Long in the second stock (MNKD) on the following instant: 26/01/2018 14:30:00 CurrentBar: 1 BarsInProgress: 1 Instrument: MNKD
So far this behaviour is OK.
When we receive confirmation that entry order was executed we set the Stop Loss and Take Profit orders and we tie them to the second stock entry order
(EnterLongMNKD1). The platform INCORRECTLY links both orders to the previous Take Profit Order of the first stock (LMFA), already cancelled (oco='NT-00002-107').
4) --> Having an open Long Position in MNKD, the strategy detects that it's time to open a Short Position on the first stock (LMFA) and opens it successfully. At this
time we have two open positions: Long MNKD and Short LMFA.
5) --> On next MNKD Bar (26/01/2018 14:30:00 CurrentBar: 2 BarsInProgress: 1 Instrument: MNKD), MNKD Stop Loss and Take Profit Orders are cancelled, causing position on this stock to be open until the end of the session.
Could you help us to solve this issue?
Kind Regards.
Comment