I want modify DataSeries and get forecast with LinReg
I wrote next code
Overlay = false;
PriceTypeSupported = false;
myDS = new DataSeries(this);}
protectedoverridevoid OnBarUpdate(){
int m = 5;
if (CurrentBar < m) return;
if (CurrentBar % m == 0){
for (int i=0; i<m; i++) {
myDS.Set( i, m+i);
Print("i= "+i+" m+i="+(m+i)+" myDS.Get(myDS.Count-i)= "+myDS.Get(myDS.Count-i));
}
double value = LinReg(myDS, m-1)[0];
Print(" The current LinReg "+m+" value is " + value.ToString());
}
i= 1 m+i=6 myDS.Get(myDS.Count-i)= 5
i= 2 m+i=7 myDS.Get(myDS.Count-i)= 6
i= 3 m+i=8 myDS.Get(myDS.Count-i)= 7
i= 4 m+i=9 myDS.Get(myDS.Count-i)= 8
The current LinReg 5 value is -37
and
how I can get forecast for only the last members myDS
example 5 from myDS.Count- 4 to myDS.Count-0 ?
Thkx
Comment