{_xAverage - Exponential Moving Average that allows for variable lookback. by Alex Matulich, Unicorn Research Corporation} Inputs: Price(NumericSeries), Length(NumericSimple); Variables: w(0), xlen(0), pv(0); if CurrentBar <= 1 then pv = Price else pv = _xAverage[1]; if xlen <> Length or CurrentBar <= 1 then begin w = 2 / (Length + 1); xlen = Length; end; _xAverage = w * Price + (1 - w) * pv;