I would like to close the secondary instrument before the end of session, I wrote this code, and it seems like it doesn't close the open positions within the time I want.
I attached a picture.
if (BarsInProgress == 1);
if ( ToTime(Time[0]) >= ToTime( 15, 50, 00)
&& ToTime(Time[0]) <= ToTime( 16, 10, 00)
&& (Positions[1].Quantity == Quantity))
{
ExitShort(Positions[1].Quantity, "END","S1");
}
I am running the analyzer on 1 minute for primary. The secondary instrument is on 300Tick.
Am I missing something?
Thank you,
Comment