indicator · on price · open source
Swing High/Low with Pivots indicator
Swing High/Low with Pivots is a free open-source indicator by @deepwick. Swing pivots — confirmed swing highs and lows marked with H/L labels. Deepwick Script runs a subset of Pine Script.
Running…
Loading chart…
What Swing High/Low with Pivots does
Swing pivots — confirmed swing highs and lows marked with H/L labels. Same engine as the ZigZag, but with explicit character labels.
swingcontrols how many bars each side of the pivot must dominate.- Lines persist using
linebrstyle so you can see the stair-step of the market. - Use as the foundation for any structure-based system.
- Toggle labels off if you only want the step-line.
- Combine with the EQH/EQL overlays to highlight liquidity pools.
- Default swing = 5 (works well on 1m–1h); raise to 10+ on daily charts for swing structure.
- The stair-step line uses
linebrstyle so the value holds steady until the next pivot prints. - Use the line-width input to match your chart's visual style.
Source code
Deepwick Script, a subset of Pine Script · read-only
//@version=6
indicator("Swing High/Low with Pivots", overlay=true)
swing = input.int(5, "Swing Length", minval=2, maxval=50)
showLabels = input.bool(true, "Show H/L Labels")
hiColor = input.string("color.green", "High Color")
loColor = input.string("color.red", "Low Color")
lineWidth = input.int(2, "Line Width", minval=1, maxval=5)
alertHi = input.bool(true, "Alert on Swing High")
alertLo = input.bool(true, "Alert on Swing Low")
alertUpdate = input.bool(false, "Alert on Any Pivot Update")
alertAll = input.bool(false, "Alert on All Events")
ph = ta.pivothigh(high, swing, swing)
pl = ta.pivotlow(low, swing, swing)
hiLine = ta.valuewhen(not na(ph), ph, 0)
loLine = ta.valuewhen(not na(pl), pl, 0)
p_Pivot_High = plot(hiLine, "Pivot High", color=hiColor, style=plot.style_linebr, linewidth=2)
p_Pivot_Low = plot(loLine, "Pivot Low", color=loColor, style=plot.style_linebr, linewidth=2)
plotshape(showLabels and not na(ph), "Swing High", style=shape.labeldown, location=location.abovebar, color=hiColor, text="H")
plotshape(showLabels and not na(pl), "Swing Low", style=shape.labelup, location=location.belowbar, color=loColor, text="L")
alertcondition(not na(ph), "Swing High", "New swing high confirmed")
alertcondition(not na(pl), "Swing Low", "New swing low confirmed")
No comments yet.
Sign in to comment.