indicator · own pane · open source

Linear Regression Slope indicator

Linear Regression Slope is a free open-source indicator. Linear Regression Slope is the per-bar change of the regression line — it shows how fast… Deepwick Script runs a subset of Pine Script.

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

What Linear Regression Slope does

Linear Regression Slope is the per-bar change of the regression line — it shows how fast the trend is moving, not just its level.

  • Above zero = trend accelerating upward, below zero = accelerating downward.
  • Flat near zero = trend exhaustion or reversal.
  • Divergences between slope and price often precede reversals.

Source code

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

//@version=6
indicator("Linear Regression Slope", overlay=false)
len = input.int(14, "Length", minval=2, maxval=200)
colorUp = input.color("color.green", "Color  Up")
colorDown = input.color("color.red", "Color  Down")
colorNeutral = input.color("color.gray", "Color  Neutral")
lrVal = ta.linreg(close, len, 0)
slope = lrVal - lrVal[1]
hline(0, "Zero", color=colorNeutral, linestyle=hline.style_dashed)
p_Slope = plot(slope, "Slope", color=slope >= 0 ? colorUp : colorDown, linewidth=2)
alertcondition(ta.crossover(slope, 0), "Slope turns up", "Linear regression slope crossed above zero")
alertcondition(ta.crossunder(slope, 0), "Slope turns down", "Linear regression slope crossed below zero")

Comments

No comments yet.

Sign in to comment.