Oversampling

Backtests become more accurate when more data is available and more trades can be opened. The problem: price data is normally in short supply. Oversampling is a method to run multiple test cycles on slightly different price curves that are derived from the original curve and contain the same inefficiencies. This produces more trades, generates more realistic backtests, and allows to evaluate the effect of price curve randomness on the system performance.

Oversampling can be applied to training or backtest, either per-bar or per-cycle. For per-bar oversampling, use price data with higher resolution than a bar period, f.i. M1 data with 1-hour bars. Oversampling shifts the timestamps are by a fraction of the bar period on any cycle. This results in different bars and - dependent on the strategy - more or less different trades with the same price curve. For per-cycle oversampling, a time offset is added to the start of any cycle. This allows to detect and eliminate start date/time dependence of training or backtests.

A description of per-bar oversampling with an example can be found on http://www.financial-hacker.com/better-tests-with-oversampling. The following variables activate and control oversampling:

NumSampleCycles

Number of oversampling cycles (default = 0 = no oversampling). When set to a number n > 1, the simulation is repeated n times. For per-bar oversampling, the bars are resampled in any cycle with different BarOffset values. This generates a slightly different price curve for every cycle, while maintaining the trend, spectrum, and most other characteristics of the curve. For per-cycle oversampling, the SampleOffset is added to the start time of any test, training, or WFO run. The performance result is calculated from the average of all cycles. This way more data for test and training is generated and a more accurate result can be achieved.

SampleOffset

Time offset in bars to be added to the begin of a test or training cycle for per-cycle oversampling. If at 0 (default), per-bar oversampling is used.

SampleCycle

The number of the current cycle from 1 to NumSampleCycles. Automatically set at the begin of any cycle.

Type:

int

Remarks:

Example:

NumSampleCycles = 4; // 4 cycles per-bar oversampling

See also:

bar, BarOffset, NumWFOCycles, NumOptCycles, NumTotalCycles, ALLCYCLES

 

► latest version online