OPEN-SOURCE SCRIPT
EMA20-EMA50 Separation Impulse

**EMA20–EMA50 Separation Impulse Indicator**
This indicator is a **trend phase classifier**, not a signal generator.
It evaluates the **structural quality of a trend** by measuring the separation between the EMA20 and EMA50, **normalized by ATR**. By using volatility-adjusted distance instead of raw price or percentage, it provides a robust and comparable measure across different instruments and timeframes.
### Key characteristics
* **Discrete states**, not a continuous oscillator
* **Independent from price scale** (displayed in a lower panel)
* **Contextual indicator**, not a timing tool
* **Fully backtestable without ambiguity**
### Logic
The indicator computes:
```
|EMA20 − EMA50| / ATR
```
Based on this normalized separation, each bar is classified into one of three market phases:
* **Green (State 1)**
Ordered trend. EMA structure is compact and stable.
The EMA-based pullback setup has a statistical edge.
* **Blue (State 2)**
Extended trend. Separation is increasing.
Edge is reduced. Trades require more selectivity or reduced position size.
* **Red (State 3)**
Overextended trend. EMAs are widely separated.
Pullbacks to EMA20 lose effectiveness. The setup has no edge.
### How to integrate it into an EMA-based system
This indicator should be used strictly as a **context filter**, not as an entry or exit trigger.
Typical integration rules:
* Allow long entries **only when State = 1 (Green)**
* Reduce position size or require stronger confirmation when State = 2 (Blue)
* Disable EMA pullback entries entirely when State = 3 (Red)
Used correctly, the indicator helps distinguish **when an EMA trend-following system is operating in its optimal environment**, and when market conditions degrade its expectancy.
It answers the question:
> *“Is this still a healthy trend for EMA pullback trading?”*
—not *“Should I buy or sell now?”*
This indicator is a **trend phase classifier**, not a signal generator.
It evaluates the **structural quality of a trend** by measuring the separation between the EMA20 and EMA50, **normalized by ATR**. By using volatility-adjusted distance instead of raw price or percentage, it provides a robust and comparable measure across different instruments and timeframes.
### Key characteristics
* **Discrete states**, not a continuous oscillator
* **Independent from price scale** (displayed in a lower panel)
* **Contextual indicator**, not a timing tool
* **Fully backtestable without ambiguity**
### Logic
The indicator computes:
```
|EMA20 − EMA50| / ATR
```
Based on this normalized separation, each bar is classified into one of three market phases:
* **Green (State 1)**
Ordered trend. EMA structure is compact and stable.
The EMA-based pullback setup has a statistical edge.
* **Blue (State 2)**
Extended trend. Separation is increasing.
Edge is reduced. Trades require more selectivity or reduced position size.
* **Red (State 3)**
Overextended trend. EMAs are widely separated.
Pullbacks to EMA20 lose effectiveness. The setup has no edge.
### How to integrate it into an EMA-based system
This indicator should be used strictly as a **context filter**, not as an entry or exit trigger.
Typical integration rules:
* Allow long entries **only when State = 1 (Green)**
* Reduce position size or require stronger confirmation when State = 2 (Blue)
* Disable EMA pullback entries entirely when State = 3 (Red)
Used correctly, the indicator helps distinguish **when an EMA trend-following system is operating in its optimal environment**, and when market conditions degrade its expectancy.
It answers the question:
> *“Is this still a healthy trend for EMA pullback trading?”*
—not *“Should I buy or sell now?”*
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.