indicator · on price · open source
Linear Regression Moving Average indicator
Linear Regression Moving Average is a free open-source indicator by @deepwick. Linear Regression Moving Average fits a least-squares line through the last N bars and… Deepwick Script runs a subset of Pine Script.
Running…
Loading chart…
What Linear Regression Moving Average does
Linear Regression Moving Average fits a least-squares line through the last N bars and plots its current value. Smoother than an EMA with comparable length and slightly leading in trends.
- Less lag than SMAs/EMAs, ideal for trend-confirmation crossovers.
- Raise N for smoother trend lines; lower it for faster turns.
- Best on trending assets; produces odd signals in tight ranges.
Source code
Deepwick Script, a subset of Pine Script · read-only
//@version=6
indicator("Linear Regression Moving Average", overlay=true)
len = input.int(14, "Length", minval=2, maxval=500)
src = input.source(close, "Source")
colorNeutral2 = input.color("color.silver", "Color Neutral2")
lrma = ta.linreg(src, len, 0)
p_LinReg_MA = plot(lrma, "LinReg MA", color=colorNeutral2, linewidth=2)
alertcondition(ta.crossover(close, lrma), "Price crosses above LinReg", "Price crossed above the linear-regression line")
alertcondition(ta.crossunder(close, lrma), "Price crosses below LinReg", "Price crossed below the linear-regression line")
No comments yet.
Sign in to comment.