indicator · on price · open source
Swing High Low
Running…
Loading chart…
About
Confirmed swing pivots — each pivothigh/pivotlow is plotted as a step line that lasts until the next one prints. Marks the actual swing points so you can see structure at a glance.
- Lines update
swingbars after the high/low forms (no repaint). - Use 3–5 for short-term structure, 10+ for swing levels.
Source code
//@version=5
indicator("Swing High Low", overlay=true)
swing = input.int(8, "Pivot left/right", minval=1, maxval=50)
sh = ta.pivothigh(high, swing, swing)
sl = ta.pivotlow(low, swing, swing)
shp = ta.valuewhen(not na(sh), sh, 0)
slp = ta.valuewhen(not na(sl), sl, 0)
p_SH = plot(shp, "SH", color=color.red, style=plot.style_linebr, linewidth=2)
p_SL = plot(slp, "SL", color=color.green, style=plot.style_linebr, linewidth=2)
No comments yet.
Sign in to comment.