https://ru.tradingview.com/script/3LGnSrQN-ZLSMA-Zero-Lag-LSMA/
Developed by @edyatl January 2023 edyatl@yandex.ru
Using Python wrapper for TA-LIB based on Cython instead of SWIG.
//@version=4
study(title = "ZLSMA - Zero Lag LSMA", shorttitle="ZLSMA", overlay=true, resolution="")
length = input(title="Length", type=input.integer, defval=32)
offset = input(title="Offset", type=input.integer, defval=0)
src = input(close, title="Source")
lsma = linreg(src, length, offset)
lsma2 = linreg(lsma, length, offset)
eq= lsma-lsma2
zlsma = lsma+eq
plot(zlsma, color=color.yellow, linewidth=3)
formula: linreg = intercept + slope * (length - 1 - offset)
linreg(source, length, offset) → series[float]
where
- length is the y argument,
- offset is the z argument,
- intercept and slope are the values calculated with the least squares method on source series (x argument)