Zero Lag Exponential Moving Average: an EMA of the source pushed ahead by its
own change over half the length, so most of the lag an EMA carries on a trend
is taken back out.
lag = floor((length - 1) / 2)
data = source + (source - source[lag])
zlema = ema(data, length)
data has no value for the first lag bars, so the EMA's first full window
ends at lag + length - 1: bar 28 at the default length of 20. On a straight
ramp with an odd length the line sits on the source exactly, which is the lag
it exists to remove.
Zero Lag Exponential Moving Average: an EMA of the source pushed ahead by its own change over half the length, so most of the lag an EMA carries on a trend is taken back out.
lag = floor((length - 1) / 2) data = source + (source - source[lag]) zlema = ema(data, length)
datahas no value for the firstlagbars, so the EMA's first full window ends atlag + length - 1: bar 28 at the default length of 20. On a straight ramp with an odd length the line sits on the source exactly, which is the lag it exists to remove.