OPEN-SOURCE SCRIPT
EMA Distance Oscillator

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).
## 📈 **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).
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
للوصول السريع إلى الرسم البياني، أضف هذا النص البرمجي إلى مفضلاتك - تعرف على المزيد هنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
للوصول السريع إلى الرسم البياني، أضف هذا النص البرمجي إلى مفضلاتك - تعرف على المزيد هنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.