indicator · on price · open source

Pivot Trend indicator

Pivot Trend is a free open-source indicator. Pivot Trend colours bars green when price is trapped between the most recent pivot low and… Deepwick Script runs a subset of Pine Script.

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

What Pivot Trend does

Pivot Trend colours bars green when price is trapped between the most recent pivot low and pivot high (the active swing range) and red when it breaks out.

  • Useful for visualising when the market is range-bound vs breaking structure.
  • A break of the range on strong volume often leads to the next leg.

Source code

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

//@version=6
indicator("Pivot Trend", overlay=true)
swing = input.int(5, "Swing Strength", minval=2, maxval=100)
colorUp = input.color("color.green", "Color  Up")
colorDown = input.color("color.red", "Color  Down")
ph = ta.pivothigh(high, swing, swing)
pl = ta.pivotlow(low, swing, swing)
lastPh = ta.valuewhen(not na(ph), ph, 0)
lastPl = ta.valuewhen(not na(pl), pl, 0)
trend = close > lastPl and close < lastPh
barcolor(trend ? colorUp : colorDown)
alertcondition(trend and not trend[1], "Inside range", "Price re-entered the active pivot range")
alertcondition(not trend and trend[1], "Out of range", "Price broke out of the active pivot range")

Comments

No comments yet.

Sign in to comment.