I am trying to understand the section of code below.

So from the manual I take it the Data parameter will be the prices & Period the number of observations.

I however do not follow the line below,

MaxVal(Data+Period2,Period2)

It is the Data+Period2 part that confuses me. If Data is a series of prices & Period2 is an integer is this line of code just adding a scalar value to the series of prices?




var FractalDimension(var* Data,int Period)
{
checkLookBack(2*Period);
Period &= ~1;
int Period2 = Max(1,Period/2);
var N1 = (MaxVal(Data,Period2)-MinVal(Data,Period2))/Period2;
var N2 = (MaxVal(Data+Period2,Period2)-MinVal(Data+Period2,Period2))/Period2;
var N3 = (MaxVal(Data,Period)-MinVal(Data,Period))/Period;
if(N1+N2 <= 0. || N3 <= 0.) return 1.;
return (log(N1+N2)-log(N3))/log(2.);
}