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, usually from 0 to NumBars-1. The number is not always counted up straight since bars can be skipped (see remarks).
Number of the first bar after the lookback period. (Bar-StartBar) is the current length of the test period in bars.
Current trading day number of the simulation, starting with the end of the lookback period. Periods with no bars, such as weekends and holidays, are skipped.
int, normally read/only
- The Bar number is increased on every run, but not always by 1. Bars are skipped when they are not used in 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. Setting Bar = NumBars aborts the simulation. Use this hack at own risk since TimeFrame and series do not consider bars that are skipped this way.
- The bar number statistics at the end of the simulation can be found under Strategy statistics.
printf("\nBar %i of %i",Bar,NumBars);
Bars, BarPeriod, BarOffset, LookBack, StartDate, run
► latest version online