Hi all,

on the path to understand how RE logic works, I've coded a simple moving average indicator, starting from a sample provided in the Samples folder (SMASample1.cs). Proceeding by trial and error, I found something that seems to go well, on chart and in simulating a strategy. But I have had to change the original CalcNewValue implementation, here below:

protected override double CalcNewValue(int index)

{

if (index < _periods - 1)

{

return double.NaN;

}

double sum = 0.0;

for (int i = index - _periods + 1; i <= index; i++)

{

sum += inputs[0][i];

}

return sum / _periods;

}

with the following:

protected override double CalcNewValue(int index)

{

if (this.Count < _periods - 1)

{

return double.NaN;

}

double sum = 0.0;

for (int i = 0; i < _periods; i++)

{

sum += inputs[0].LookBack(index + i);

}

return sum / _periods;

}

The question is: is it my updated version coded as expected in the current version of RE ? If the example provided by RE is out of date, is it possible to refer to better documentation and avoid to reinvent the wheel ?

Thank you in advance