Len = Param("Len", 20, 10, 50, 10);
factor = 2
/ (Len + 1);
e1 = e2 = Close[0];
for(i
= 0; i < BarCount; i++)
{
e1 = factor * Close[
i ] + ( 1 - factor
) * e1;
e2 = factor * e1 + (1
- factor) * e2;
myDemaIIF[i] = IIf(len
== 20, 2 * e1 - e2, 0);
}
Plot(myDemaIIF,
"Dema in iif loop",
colorRed);
Plot(DEMA(C, Len), "Built-in DEMA", colorWhite);