Reading the NT help guide and multiple posts on this forum (and special thanks to Chelsea's example that he gave in a previous post), I can get the rollover date of the current contract by using something like this:
Rollover contractRollover = null;
for (int i = 0; i < Instrument.MasterInstrument.RolloverCollection.Cou nt; i++)
{
if (Instrument.Expiry == Instrument.MasterInstrument.RolloverCollection[i].ContractMonth)
{
contractRollover = Instrument.MasterInstrument.RolloverCollection[i];
break;
}
}
DateTime rolloverDate = contractRollover.Date;
I need some help to extend code logic: (1) today's date is the rollover date, AND, (2) during the penultimate 1-hour bar before the rollover, I want to send a market order to close out all my positions for the final 1-hour bar before rollover.
Can someone help me write this code logic?
Many thanks.
Comment