OPEN-SOURCE SCRIPT
Higher High Lower Low

Higher High Lower Low 🦉{Phanchai} — TradingView Description
Structure detector with dynamic Support/Resistance, customizable labels, and ready-made alerts (Pine v6).
What it does
How it works (in short)
Alerts included
How to use (quick start)
Notes & tips
Built with Pine v6. Clean, compact labels; segmented S/R that updates only on confirmed changes; comprehensive alerts ready for automation.
Structure detector with dynamic Support/Resistance, customizable labels, and ready-made alerts (Pine v6).
This script marks market structure turning points — HH (Higher High), HL (Higher Low), LH (Lower High), LL (Lower Low) — and builds segmented Support/Resistance lines from those turns. Labels and colors are fully customizable and the script ships with multiple alert conditions.
What it does
- Detects swing pivots using left/right bar windows, then classifies each confirmed swing as HH/HL/LH/LL.
- Plots compact labels at the confirmed pivot bars with tooltips (English).
- Derives dynamic Support/Resistance: every time structure flips, the previous level is closed and a new segment starts, extending to the right.
- Provides alert conditions for any label and for specific first-occurrence shifts (e.g., first HH after a bearish label).
How it works (in short)
- A pivot high/low confirms only after Right Bars candles have closed; labels and S/R appear at that confirmation bar.
- An internal backbone (zigzag-like) is built from confirmed pivots, with light consistency checks to avoid contradictory sequences.
- Structure rules compare the recent five pivots (A…E) to decide HH/HL/LH/LL.
- S/R is updated from structure: e.g., in an up leg, new HLs refresh Support; in a down leg, new LHs refresh Resistance.
Alerts included
- Any structure label (HH/HL/LH/LL) — Fires on any new label.
- First LL after HL/HH — First bearish break after a bullish label.
- First HH after LL/LH — First bullish break after a bearish label.
- LL or HL formed — Any low-side label.
- LH or HH formed — Any high-side label.
- HL formed
- HH formed
- LL formed
- LH formed
How to use (quick start)
- Add the indicator to your chart.
- Choose Left/Right Bars for your timeframe (e.g., 5–10 for intraday; larger for higher timeframes).
- Pick your label colors/sizes and S/R style.
- Right-click the chart → Add alert… → Condition: this indicator → select the desired alert.
Notes & tips
- Because pivots require Right Bars to confirm, labels and S/R appear with a natural delay of that many bars. This avoids repainting.
- Raising Left/Right Bars reduces noise and increases the average distance between pivots; lowering them increases sensitivity.
- Structure is strict: sometimes you may see two HL (or two LH) in a row if the intermediate opposite swing didn’t qualify as HH/LH (or LL/HL).
- S/R segments are drawn with line objects; they are controlled via Inputs (style/width/color), not the Style tab.
- This tool highlights structure; it’s not a standalone entry/exit system. Combine with volume, trend, or risk management rules.
Built with Pine v6. Clean, compact labels; segmented S/R that updates only on confirmed changes; comprehensive alerts ready for automation.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.