Total number of bars in the simulation, determined from Lookback, StartDate and EndDate and from the available data in the price history files. Is 0 in the initial run before the first asset call.
Current bar number including the lookback period, from 0 to NumBars-1. Setting Bar = NumBars aborts the simulation.
Number of the first bar after the lookback period.
Current trading day number of the simulation, starting with the end of the lookback period. Weekends are skipped.
- The Bar number is increased on every run, but not always by 1. Bars are skipped when they are not used for the simulation. For instance, in WFO training cycles all bars preceding the LookBack period before the current training frame are skipped.
- For running a simulation in greater steps as a bar period for special purposes (f.i. for generating histograms), bars can be skipped by adding a number to Bar at the end of the run function. F.i. Bar += 9; will call the run function only every 10th bar. Restriction: Don't use TimeFrame and series in this case, as the series are not correctly shifted when bars are skipped.
printf("\nBar %i of %i",Bar,NumBars);
Bars, BarPeriod, BarOffset, LookBack, StartDate, run
► latest version online