My 2-minute bar options strategy surfaced a problem on 2.40.2

This is the code I use to load the options chain for the upcoming bar inside tock, when in Test mode.

The month() call is used to specify the T8 file name.

As you can see from the attached screenshot, month() stays at 1 when the actual month changed to February. This continues for the entire simulation period, LOOKBACK or not, resulting in no trades.

This code works fine in 2.35.6 and previous version going back at least couple of years.

Looks like month() is acting weird inside of tock(), or maybe elsewhere too.

Code

if (!Live)	{
		
		printf("\n[%d] TOCK -- [%s] Loading chain... ",utcHHMM, Asset);
		if(month()!=month(1) or Init) {		
			sprintf(OptionFile,"%s\\%s_%d%02d_m1.t8", HistFolder, Asset, year(),month());
			dataLoad(1,OptionFile,9);	
		}
		
		if (!Init)	{
			int Chain = contractUpdate(Asset,1,PUT|CALL); 
			if(Live || DEBUG) printf("\n[%d] TOCK -- [%s] %d contracts loaded...\n\n",utcHHMM, OptionFile, Chain);	
		}
	}

Attached Files
tock-chain-load.PNG (73 downloads)