hi jcl,
It looks like the problem is not the month() function, but rather the month(1) offset at the 1st bar of a new month.
As you can see from the log snippet below, the first bar on 21-02-01 shows: month(0)=2 and month(1)=2.
You agree that it should be: month(0)=2 and month(1)=1?
function tock()
....
printf("\n[%d] TOCK -- [%s] month()=%d month(1)=%d... ",utcHHMM, Asset,month(),month(1));
if(month()!=month(1) or Init) {
sprintf(OptionFile,"%s\\%s_%d%02d_m1.t8", HistFolder, Asset, year(),month());
printf("T8: %s\n",OptionFile);
}
..................Log entry................
[974: Fri 21-01-29 20:58] 3730.72/3734.22\3727.72/3727.72 -0.01
[2058] TOCK -- [SPX] month(0)=1 month(1)=1...
[975: Mon 21-02-01 14:30] 3727.72/3727.72\3703.61/3707.86 -0.01
[1430] TOCK -- [SPX] month(0)=2 month(1)=2...