OPEN-SOURCE SCRIPT

EMA Distance Oscillator

233
I was inspired to make this because I rely on ema trading in my SPY day trading strategy.

## ๐Ÿ“ˆ **EMA Distance Oscillator**

**Author:** *Your Name or Alias*
**Category:** Trend Strength / Momentum
**Timeframes:** Optimized for 1โ€“5min, works on all

---

### ๐Ÿ” **What It Does**

The **EMA Distance Oscillator** is a dual-purpose tool that helps visualize **momentum shifts**, **trend strength**, and **EMA divergence/convergence** in real time.

It plots two separate signals:

#### 1. ๐ŸŸฉ Histogram Bars
A zero-centered histogram that shows the **difference between two EMAs** (default: EMA 48 and EMA 200).
- Color-coded based on:
- Whether the EMA spread is **above or below zero**
- Whether the spread is **increasing or decreasing**
- Helps visualize **trend acceleration** or **loss of momentum**

#### 2. ๐Ÿ“‰ Delta Line
A smooth line showing the **difference between a second EMA pair** (default: EMA 13 and EMA 48).
- Color-coded:
- **White** when rising (spread widening)
- **Gray** when falling (spread tightening)

---

### โš™๏ธ **Customizable Inputs**
You have full control over:
- EMA lengths for **both histogram and line**
- Smoothing for each plot
- Colors for each bar state and line condition
- Momentum thresholds (ยฑ1 by default, adjustable)

---

### ๐Ÿง  **How to Use It**
- Use the **bar histogram** to quickly spot moments when short-term and long-term EMAs are diverging or converging
- Use the **delta line** to track smoother shifts in short-term momentum
- Look for:
- Expanding green bars = uptrend gaining strength
- Shrinking bars = potential reversals or cooldowns
- Line crossing zero = EMA crossover (fast vs slow)
- **Threshold lines** at +1 / -1 help mark **high-momentum zones** (fully customizable)

---

### ๐Ÿงญ **Pro Tips**
- Try with EMA 13/48 for the line and EMA 48/200 for the histogram on 1โ€“5min charts
- Add alerts (optional) for when:
- Histogram changes color (momentum flip)
- Line crosses zero
- Threshold levels are breached


---

Let me know if you want me to help prep alert conditions or auto-generate different versions (e.g., strategy version, simplified mode, mobile-friendly layout, etc).

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.