OPEN-SOURCE SCRIPT
SMC EMA CROSS ZIG ZAG

# Mega Trend Suite – SMC + EMA (Lightweight Edition)
**A professional Smart Money Concepts (SMC) toolkit combined with classic EMA crossovers and VWAP.**
No Heikin Ashi, no MA Cross EMA – just clean price action, order flow, and trend confirmation.
---
## 🔍 Overview
This indicator bundles the most essential tools for **institutional-style analysis**:
- ✅ **SMC Structure** (internal & swing BOS/CHoCH)
- ✅ **Order Blocks** (bullish/bearish, with box or candle highlight)
- ✅ **Fair Value Gaps (FVG)** with auto threshold & multi‑timeframe support
- ✅ **Premium / Discount Zones** + Equilibrium line
- ✅ **Multi‑Timeframe High/Low levels** (Daily / Weekly / Monthly)
- ✅ **ZigZag** (main & internal) with HH/HL/LH/LL labels
- ✅ **VWAP** – anchored to the session
- ✅ **Two EMA sets** (9/21 & 20/50) with cross signals
- ✅ **Compact Dashboard** (SMC bias & current timeframe)
- ✅ **Full alert system** for all SMC events and EMA crosses
---
## 🧠 Key Features Explained
### 1. Smart Money Concepts (SMC)
| Component | What it does |
|-----------|---------------|
| **Swing Structure** | Detects Break of Structure (BOS) and Change of Character (CHoCH) on a higher‑length pivot (default 50). Shows labels “BOS” or “CHoCH” when price crosses a swing high/low. |
| **Internal Structure** | Same as swing, but uses a shorter length (default 10) to catch micro‑structure changes. Optional confluence filter (body vs. wick). |
| **Order Blocks (OB)** | Stores the extreme bar (parsed by volatility filter) after a valid BOS/CHoCH. Displays as zone boxes or candle highlights. Mitigation detection (close / high/low). |
| **Fair Value Gaps (FVG)** | Detects 3‑bar imbalances on a chosen timeframe (or current). Uses auto‑threshold based on historical bar delta. Extendable boxes. |
| **Premium / Discount Zones** | Calculates the range between the highest swing high and lowest swing low. Shades the upper 50% (premium) and lower 50% (discount) with an equilibrium line in the middle. |
| **MTF High/Low Levels** | Plots previous period’s high/low for Daily, Weekly, Monthly. Line style (solid/dashed/dotted) and color customizable. |
| **ZigZag** | Classic pivot‑based ZigZag with HH/HL/LH/LL labels. Separate internal ZigZag available for finer swings. |
### 2. VWAP
- Standard Volume Weighted Average Price.
- Useful for intraday bias – price above VWAP = bullish tilt.
### 3. EMA Sets
Two independent EMA pairs:
- **Set 1:** 9 & 21 (fast)
- **Set 2:** 20 & 50 (slower)
Each set plots its own lines and generates up/down triangles on crossover / crossunder. Colours, widths, and signal colours are fully adjustable.
---
## ⚙️ Input Parameters (Grouped)
### 🔧 Master Controls
- `Enable SMC Module` – turn all SMC features on/off.
### 📊 SMC – General
- `Mode` – Historical (keeps all drawings) / Present (refreshes each bar).
- `Style` – Colored / Monochrome.
### 📊 SMC – Structure & Order Blocks
- Internal / Swing lengths, label sizes, BOS/CHoCH filter (All / BOS only / CHoCH only).
- OB display mode (Both / Zone Box / Candle Highlight).
- OB mitigation source (Close / High/Low).
- OB filter (ATR / Cumulative Mean Range).
### 📊 SMC – Fair Value Gaps
- Auto threshold on/off, custom timeframe, extend bars.
### 📊 SMC – MTF High/Low Levels
- Show Daily / Weekly / Monthly – each with independent line style & colour.
### 📊 SMC – Premium / Discount Zones
- Toggle zones, custom colours for premium, equilibrium, discount.
### 📊 ZigZag Swing Lines
- Main ZigZag depth/deviation/backstep, colours, width, style, labels.
- Optional internal ZigZag with separate settings.
### 📈 VWAP & EMA Sets
- VWAP on/off, colour, width.
- Two EMA sets: each with fast/slow lengths, colours, line width, cross signal colours.
### 📊 Dashboard
- Position (Top‑Left/Right, Bottom‑Left/Right), font size.
### 🎨 Colors
- Global bull / bear / neutral colours (used in dashboard).
---
## 🖥️ Dashboard
A small table shows at a glance:
- **SMC Bias** – Bullish / Bearish / Neutral (based on swing trend).
- **Current Timeframe** – e.g., “60” for 1h, “D” for daily.
The dashboard adapts to dark/light chart background.
---
## 🚨 Alerts (30+ conditions)
All alerts are available from the TradingView alert dialog:
| Category | Alerts |
|----------|--------|
| **Internal Structure** | Bull/Bear BOS, Bull/Bear CHoCH |
| **Swing Structure** | Bull/Bear BOS, Bull/Bear CHoCH |
| **Order Blocks** | Bull/Bear Internal OB mitigated, Bull/Bear Swing OB mitigated |
| **Fair Value Gaps** | Bull FVG formed, Bear FVG formed |
| **EMA Crosses** | EMA Set 1/2 Bull Cross, Bear Cross |
---
## 🧩 How to Use
1. **Add the indicator** to any chart (any symbol, any timeframe).
2. **Keep default settings** for a clean SMC + EMA experience.
3. **For scalping / intraday:**
- Enable Internal Structure (length 5–10).
- Use VWAP as bias filter.
- Watch for FVGs on 1m–15m.
4. **For swing trading:**
- Focus on Swing Structure (length 50+).
- Use Premium/Discount zones for entries (buy in discount, sell in premium).
- Confirm with EMA Set 2 (20/50) cross.
5. **Order Blocks:**
- When price returns to a bullish OB zone, look for buying opportunities.
- When a bearish OB gets mitigated, expect continuation down.
---
## 💡 Tips
- **Monochrome style** is perfect for grayscale / minimalistic setups.
- **Present mode** keeps drawings only on the current visible bars – useful for low‑resource usage.
- **FVG auto‑threshold** works best on higher timeframes (1h+). For lower timeframes, you may turn it off and use manual threshold via the `barDelta` calculation (already built‑in).
- The **ZigZag** does not repaint – it uses confirmed pivots.
---
## 📜 Credits & Version
- **Original concept:** Mega Trend Suite (SMC + HAMA + MA Cross EMA)
- **This edition:** Removed HAMA, MA Cross EMA, and Heikin Ashi Smoothed – keeping only SMC, VWAP, and EMA sets.
- **Version:** 1.0 (Pine Script v6)
---
## ❗ Notes
- This indicator is **not a financial advice** – always use proper risk management.
- Maximum drawings (labels, lines, boxes) are set to 500 each – enough for several months of data.
- Multi‑timeframe levels (Daily/Weekly/Monthly) work correctly only if the chart has enough historical data.
---
**Happy trading!**
*Mega Trend Suite – SMC + EMA*
**A professional Smart Money Concepts (SMC) toolkit combined with classic EMA crossovers and VWAP.**
No Heikin Ashi, no MA Cross EMA – just clean price action, order flow, and trend confirmation.
---
## 🔍 Overview
This indicator bundles the most essential tools for **institutional-style analysis**:
- ✅ **SMC Structure** (internal & swing BOS/CHoCH)
- ✅ **Order Blocks** (bullish/bearish, with box or candle highlight)
- ✅ **Fair Value Gaps (FVG)** with auto threshold & multi‑timeframe support
- ✅ **Premium / Discount Zones** + Equilibrium line
- ✅ **Multi‑Timeframe High/Low levels** (Daily / Weekly / Monthly)
- ✅ **ZigZag** (main & internal) with HH/HL/LH/LL labels
- ✅ **VWAP** – anchored to the session
- ✅ **Two EMA sets** (9/21 & 20/50) with cross signals
- ✅ **Compact Dashboard** (SMC bias & current timeframe)
- ✅ **Full alert system** for all SMC events and EMA crosses
---
## 🧠 Key Features Explained
### 1. Smart Money Concepts (SMC)
| Component | What it does |
|-----------|---------------|
| **Swing Structure** | Detects Break of Structure (BOS) and Change of Character (CHoCH) on a higher‑length pivot (default 50). Shows labels “BOS” or “CHoCH” when price crosses a swing high/low. |
| **Internal Structure** | Same as swing, but uses a shorter length (default 10) to catch micro‑structure changes. Optional confluence filter (body vs. wick). |
| **Order Blocks (OB)** | Stores the extreme bar (parsed by volatility filter) after a valid BOS/CHoCH. Displays as zone boxes or candle highlights. Mitigation detection (close / high/low). |
| **Fair Value Gaps (FVG)** | Detects 3‑bar imbalances on a chosen timeframe (or current). Uses auto‑threshold based on historical bar delta. Extendable boxes. |
| **Premium / Discount Zones** | Calculates the range between the highest swing high and lowest swing low. Shades the upper 50% (premium) and lower 50% (discount) with an equilibrium line in the middle. |
| **MTF High/Low Levels** | Plots previous period’s high/low for Daily, Weekly, Monthly. Line style (solid/dashed/dotted) and color customizable. |
| **ZigZag** | Classic pivot‑based ZigZag with HH/HL/LH/LL labels. Separate internal ZigZag available for finer swings. |
### 2. VWAP
- Standard Volume Weighted Average Price.
- Useful for intraday bias – price above VWAP = bullish tilt.
### 3. EMA Sets
Two independent EMA pairs:
- **Set 1:** 9 & 21 (fast)
- **Set 2:** 20 & 50 (slower)
Each set plots its own lines and generates up/down triangles on crossover / crossunder. Colours, widths, and signal colours are fully adjustable.
---
## ⚙️ Input Parameters (Grouped)
### 🔧 Master Controls
- `Enable SMC Module` – turn all SMC features on/off.
### 📊 SMC – General
- `Mode` – Historical (keeps all drawings) / Present (refreshes each bar).
- `Style` – Colored / Monochrome.
### 📊 SMC – Structure & Order Blocks
- Internal / Swing lengths, label sizes, BOS/CHoCH filter (All / BOS only / CHoCH only).
- OB display mode (Both / Zone Box / Candle Highlight).
- OB mitigation source (Close / High/Low).
- OB filter (ATR / Cumulative Mean Range).
### 📊 SMC – Fair Value Gaps
- Auto threshold on/off, custom timeframe, extend bars.
### 📊 SMC – MTF High/Low Levels
- Show Daily / Weekly / Monthly – each with independent line style & colour.
### 📊 SMC – Premium / Discount Zones
- Toggle zones, custom colours for premium, equilibrium, discount.
### 📊 ZigZag Swing Lines
- Main ZigZag depth/deviation/backstep, colours, width, style, labels.
- Optional internal ZigZag with separate settings.
### 📈 VWAP & EMA Sets
- VWAP on/off, colour, width.
- Two EMA sets: each with fast/slow lengths, colours, line width, cross signal colours.
### 📊 Dashboard
- Position (Top‑Left/Right, Bottom‑Left/Right), font size.
### 🎨 Colors
- Global bull / bear / neutral colours (used in dashboard).
---
## 🖥️ Dashboard
A small table shows at a glance:
- **SMC Bias** – Bullish / Bearish / Neutral (based on swing trend).
- **Current Timeframe** – e.g., “60” for 1h, “D” for daily.
The dashboard adapts to dark/light chart background.
---
## 🚨 Alerts (30+ conditions)
All alerts are available from the TradingView alert dialog:
| Category | Alerts |
|----------|--------|
| **Internal Structure** | Bull/Bear BOS, Bull/Bear CHoCH |
| **Swing Structure** | Bull/Bear BOS, Bull/Bear CHoCH |
| **Order Blocks** | Bull/Bear Internal OB mitigated, Bull/Bear Swing OB mitigated |
| **Fair Value Gaps** | Bull FVG formed, Bear FVG formed |
| **EMA Crosses** | EMA Set 1/2 Bull Cross, Bear Cross |
---
## 🧩 How to Use
1. **Add the indicator** to any chart (any symbol, any timeframe).
2. **Keep default settings** for a clean SMC + EMA experience.
3. **For scalping / intraday:**
- Enable Internal Structure (length 5–10).
- Use VWAP as bias filter.
- Watch for FVGs on 1m–15m.
4. **For swing trading:**
- Focus on Swing Structure (length 50+).
- Use Premium/Discount zones for entries (buy in discount, sell in premium).
- Confirm with EMA Set 2 (20/50) cross.
5. **Order Blocks:**
- When price returns to a bullish OB zone, look for buying opportunities.
- When a bearish OB gets mitigated, expect continuation down.
---
## 💡 Tips
- **Monochrome style** is perfect for grayscale / minimalistic setups.
- **Present mode** keeps drawings only on the current visible bars – useful for low‑resource usage.
- **FVG auto‑threshold** works best on higher timeframes (1h+). For lower timeframes, you may turn it off and use manual threshold via the `barDelta` calculation (already built‑in).
- The **ZigZag** does not repaint – it uses confirmed pivots.
---
## 📜 Credits & Version
- **Original concept:** Mega Trend Suite (SMC + HAMA + MA Cross EMA)
- **This edition:** Removed HAMA, MA Cross EMA, and Heikin Ashi Smoothed – keeping only SMC, VWAP, and EMA sets.
- **Version:** 1.0 (Pine Script v6)
---
## ❗ Notes
- This indicator is **not a financial advice** – always use proper risk management.
- Maximum drawings (labels, lines, boxes) are set to 500 each – enough for several months of data.
- Multi‑timeframe levels (Daily/Weekly/Monthly) work correctly only if the chart has enough historical data.
---
**Happy trading!**
*Mega Trend Suite – SMC + EMA*
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.