Looping OHLC sample

The source for Looping OHLC

Looping OHLC

In this example we show how to build lists that can be used to construct values for backtesting.

In backtesting we want to loop through several parameter combinations so using fixed values is not feasible. We use standard list type and fill it with values of interest.

For daily values we use last three.

List _ohlcDailyValues = new List {};
for(int i=0; i<3; i++)
double _ohlcDailyAverage = _ohlcDailyValues.Average();

For hourly values we use last six.

List _ohlcHourlyValues = new List {};
for(int i=0; i<6; i++)
double _ohlcHourlyAverage = _ohlcHourlyValues.Average();

For fifteen minute values we use last four.

List _ohlcFifteenMinuteValues = new List {};
for(int i=0; i<4; i++)
double _ohlcFifteenMinuteAverage = _ohlcFifteenMinuteValues.Average();

Now values are available for standard list operations as seen in average operation example.