indicator · on price · open source

Linear Regression indicator

Linear Regression is a free open-source indicator. Linear Regression curve fits a straight line to the last N closes — the cleanest trend line… Deepwick Script runs a subset of Pine Script.

v1Updated 3 Oct 2026▲ 0 users
Running…
Loading chart…

What Linear Regression does

Linear Regression curve fits a straight line to the last N closes — the cleanest trend line you can draw programmatically.

  • Price above the line = bullish bias, below = bearish bias.
  • Touches of the line often act as dynamic support/resistance.
  • Combine two regressions of different windows for a ribbon.

Source code

Deepwick Script, a subset of Pine Script · read-only

//@version=6
indicator("Linear Regression", overlay=true)
len = input.int(14, "Length", minval=2, maxval=200)
colorLine = input.color("color.blue", "Color  Line")
lrVal = ta.linreg(close, len, 0)
p_Linear_Reg = plot(lrVal, "Linear Reg", color=colorLine, linewidth=2)
alertcondition(ta.crossover(close, lrVal), "Price above regression", "Close crossed above the regression line")
alertcondition(ta.crossunder(close, lrVal), "Price below regression", "Close crossed below the regression line")

Comments

No comments yet.

Sign in to comment.