Type : Indicator, Name : Recursive Moving Trendline Indicator
inputs: ndays(25); vars: alpha(0),
bo(0),
bo1(c),
xest(0),
xest1(c),
ema(0),
ema1(c);
alpha = 2 / (ndays + 1);
bo = (1 — alpha) * bo1 + close;
ema = ema1 + alpha * (close — ema1);
xest = (1 — alpha) * xest1 + alpha * (close + bo — bo1);
bo1 = bo;
xest1 = xest;
ema1 = ema;
if barnumber > 50 then begin
plot1(xest,»Xest»);
plot2(ema,»EMA»);
end;