I'm using a multi-time series strategy and I'm doing trades in both instruments simultaneously.
I need the strategy to close any open position when I enter a reverse trade. (ej. if I am going short, I would like to close it and then enter a long position)
Everything has to be done in the same bar and in the same run of the BarUpdate() and if I have the entry condition for a long but I'm already in a long position, nothing is done.
The problem is that the Short position (in the example code below) is not close with the ExitShort() command. What can be wrong?
Mi code is the following:
if(Entry Condition)
if(myEntryOrder2 != null)
{
if(myEntryOrder2.OrderAction == OrderAction.SellShort)
{
ExitShort(1,c2,"Inst2","Inst2");
myEntryOrder2=EnterLong(1,c2,"Inst2");
}
}
else
myEntryOrder2=EnterLong(1,c2,"Inst2");
}
Comment