OPEN-SOURCE SCRIPT
[eLm] 0-1-2

# 📈 Market Structure Indicator – Counter System
This indicator dynamically analyzes price action to detect key market structure shifts and trend strength using four essential formations:
## 🔍 Detected Structures
- **Higher High (HH):** A candle forming a new high above recent peaks
- **Lower Low (LL):** A candle forming a new low below recent bottoms
- **Higher Low (HL):** A higher dip, indicating potential trend continuation
- **Lower High (LH):** A lower peak, signaling potential weakness
## 🧠 Structure Protection Logic
After a HH or LL is formed, if price does not breach that level within a user-defined number of candles, the level is considered **"protected."**
This provides insight into trend strength and market reaction.
## 🔢 HL / LH Counter System
- Each HL or LH increases a counter.
- A new HH or LL **resets** the corresponding counter to zero.
> This helps visualize how many consecutive HL or LH structures have occurred — useful for measuring trend momentum.
## 🎯 Use Cases
- Trend following and confirmation
- Early trend reversal detection
- Building structure-based trading strategies
- Understanding price behavior and market intent
---
> **Note:** This indicator does not provide financial advice. It is designed to support technical analysis with clear, structure-based visual signals.
This indicator dynamically analyzes price action to detect key market structure shifts and trend strength using four essential formations:
## 🔍 Detected Structures
- **Higher High (HH):** A candle forming a new high above recent peaks
- **Lower Low (LL):** A candle forming a new low below recent bottoms
- **Higher Low (HL):** A higher dip, indicating potential trend continuation
- **Lower High (LH):** A lower peak, signaling potential weakness
## 🧠 Structure Protection Logic
After a HH or LL is formed, if price does not breach that level within a user-defined number of candles, the level is considered **"protected."**
This provides insight into trend strength and market reaction.
## 🔢 HL / LH Counter System
- Each HL or LH increases a counter.
- A new HH or LL **resets** the corresponding counter to zero.
> This helps visualize how many consecutive HL or LH structures have occurred — useful for measuring trend momentum.
## 🎯 Use Cases
- Trend following and confirmation
- Early trend reversal detection
- Building structure-based trading strategies
- Understanding price behavior and market intent
---
> **Note:** This indicator does not provide financial advice. It is designed to support technical analysis with clear, structure-based visual signals.
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.