indicator · on price · open source
Equal Highs (EQH)
Running…
Loading chart…
About
Equal Highs (EQH) — two consecutive confirmed swing highs within a percentage tolerance. A classic liquidity pool that price loves to sweep before reversing.
- A line connects the two highs; the line extends forward.
tolerancePctcontrols how 'equal' the two highs must be (default 0.5%).- Triangles mark the EQH confluence.
Source code
//@version=5
indicator("Equal Highs (EQH)", overlay=true)
swing = input.int(5, "Swing Length", minval=2, maxval=50)
tolerancePct = input.float(0.5, "Tolerance %", minval=0, maxval=2, step=0.1)
ph = ta.pivothigh(high, swing, swing)
var float lastPh = na
var float prevPh = na
if not na(ph)
prevPh := lastPh
lastPh := ph
tol = tolerancePct / 100
eqh = not na(lastPh) and not na(prevPh) and math.abs(lastPh - prevPh) <= math.max(lastPh, prevPh) * tol
var float eqhLevel = na
if eqh
eqhLevel := math.max(lastPh, prevPh)
p_EQH_Level = plot(eqhLevel, "EQH Level", color=color.orange, style=plot.style_stepline, linewidth=2)
plotshape(eqh and not eqh[1], "EQH", style=shape.diamond, location=location.abovebar, color=color.orange, text="EQH")
alertcondition(eqh and not eqh[1], "Equal highs", "Two swing highs within tolerance")
No comments yet.
Sign in to comment.