Synthetic Price

 

Hi to all the expert coders:)

I am trying to build a synthetic price line. It is a 1 unit moving average (or the last closing price) + Y (which is: fib1[pos] below).

Can someone look at ema2[pos3] and tell me what I am doing wrong.

Thank you,



V =
W =
X =
Y = (V + W + X);


fib1[pos] = Y;
fib2[pos] = AB;
fib3[pos] = AC;
fib4[pos] = Z;
fib5[pos] = Zt;
fib6[pos] = Zb;
fib7[pos] = movavg;

pos--;

}


while(pos2>=0)
{
ema[pos2]=iMAOnArray(fib1,Bars,40,0,MODE_EMA,pos2) ; //
pos2--;
}


while(pos3>=0)
{
ema2[pos3]= ema[pos3] + iMAOnArray(fib7,Bars,1,0,MODE_EMA,pos3); //
pos3--;
}

Reason: