OPEN-SOURCE SCRIPT
Trapper Market Structure (HH, HL, LH, LL)

This script is designed to visually identify price action market structure in real time using pivot-based logic. It highlights the key components of trend direction by labeling:
- **HH** – Higher Highs
- **HL** – Higher Lows
- **LH** – Lower Highs
- **LL** – Lower Lows
These labels help traders track evolving market conditions and spot trend continuations, breaks in structure, or potential reversals — all without guessing.
**How It Works**
The script detects local swing highs and lows based on a customizable pivot strength. Once a valid pivot is confirmed, it’s classified in context with the previous relevant pivot to determine its structural significance.
For example:
- If a pivot high is higher than the previous, it’s marked as a **HH**.
- If a pivot low is lower than the previous, it’s marked as a **LL**, and so on.
This running analysis helps traders anticipate shifts between bullish and bearish structures.
**Customizable Features**
- Adjust **Pivot Strength** to increase or reduce sensitivity (more reactive or more stable)
- Toggle **Labels** on/off for cleaner charts
- Toggle **Connecting Lines** between pivots to visualize structure flow
**Use Case**
This indicator is ideal for:
- Price action traders
- Market structure analysis
- Identifying entry zones during pullbacks (e.g., buying at HLs during uptrends)
- Confirming trend reversals or break-of-structure (BoS)
You can use this tool as a foundation for more advanced systems such as CHoCH/BOS detection, liquidity zones, or sniper-style entry frameworks.
**Concepts Used**
- Swing High/Low detection using `ta.pivothigh` and `ta.pivotlow`
- Market structure labeling logic
- Visual flow to reinforce trader psychology on trend states
Disclaimer
This script is provided for educational purposes only. It is not financial advice and should not be relied upon for trading decisions. Always conduct your own analysis and risk management.
#marketstructure #priceaction #technicalanalysis #tradingviewopen #pivotpoints
- **HH** – Higher Highs
- **HL** – Higher Lows
- **LH** – Lower Highs
- **LL** – Lower Lows
These labels help traders track evolving market conditions and spot trend continuations, breaks in structure, or potential reversals — all without guessing.
**How It Works**
The script detects local swing highs and lows based on a customizable pivot strength. Once a valid pivot is confirmed, it’s classified in context with the previous relevant pivot to determine its structural significance.
For example:
- If a pivot high is higher than the previous, it’s marked as a **HH**.
- If a pivot low is lower than the previous, it’s marked as a **LL**, and so on.
This running analysis helps traders anticipate shifts between bullish and bearish structures.
**Customizable Features**
- Adjust **Pivot Strength** to increase or reduce sensitivity (more reactive or more stable)
- Toggle **Labels** on/off for cleaner charts
- Toggle **Connecting Lines** between pivots to visualize structure flow
**Use Case**
This indicator is ideal for:
- Price action traders
- Market structure analysis
- Identifying entry zones during pullbacks (e.g., buying at HLs during uptrends)
- Confirming trend reversals or break-of-structure (BoS)
You can use this tool as a foundation for more advanced systems such as CHoCH/BOS detection, liquidity zones, or sniper-style entry frameworks.
**Concepts Used**
- Swing High/Low detection using `ta.pivothigh` and `ta.pivotlow`
- Market structure labeling logic
- Visual flow to reinforce trader psychology on trend states
Disclaimer
This script is provided for educational purposes only. It is not financial advice and should not be relied upon for trading decisions. Always conduct your own analysis and risk management.
#marketstructure #priceaction #technicalanalysis #tradingviewopen #pivotpoints
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.