Hopefully one could help me with the following problem I am stuck with:
When trading different strategies on the same underlying (E-Mini) I want to close all open positions a few seconds before market closes. So I enabled Exit On Close with the standard 30 seconds on all strategies and template session CME US Index Futures ETH.
Now, every strategy has it's own label name for the entry and exit, so under the execution tab all trades are gathered and the different trades can be seen. I assume these names are also used by Ninjatrader to figure out which strategy holds what position, or better said, holds a position or not.
It happens that one of the strategies holds a long position, where another is short. So NT has two open positions, a long and short on the same underlying. In my trading platform (IB's TWS) there are no running positions, which is correct while the long and short flattened each other with the last trade. When this situation still is when the Exit On Close is triggered, two things happen which I would like to alter:
1. First of all NT initiate two orders for TWS; to close the long and the short. This while there are no physical open positions, but these only is the 'technical' individual state of the two strategies with both an open position. So two orders are executed while this is not neccesary. I only want to have NT set the positions of all strategies on zero again, when there are no running positions in TWS, which also can be seen under the positions tab in NT.
2. When the Exit On Close orders are executed, these orders get the name 'Exit on close' labeled and NT probably no longer matches the correct open positions to each individual strategy. The Exit On Close did close two positions (not needed as stated under previous point) and thus closed the overall positions to zero, but the two strategies who needed to be closed still state to hold their position. It seems that the label name Exit On Close does not match the exit position name each strategy needs to calculate it's theoretical position, so these open positons stay unchanged while NT closed them with the forced Exit On Close. From this moment strategies need to be disabled manually to set them on zero position again, otherwise no new entries are triggered.
Is there any way to work this out another way? TheToTime method is not an option, while the strategies trigger on the On Bar Update and not every day a new bar is triggered near the end of a session (2 renko strategy). Flatten everything under the Initialize isn't an option also, while this disables all strategies. I just need the name label Exit On Close to match the open strategies. Now the Exit On Close orders are unique orders not matching the one they are in fact closing.
Kind regards,
Francis
Comment