OPEN-SOURCE SCRIPT
Cập nhật EMA Position Alert

Description
EMA Position Alert is a comprehensive trend analysis tool designed to help traders instantly identify the market's direction and strength relative to key Exponential Moving Averages (EMAs). By combining visual trend lines with a real-time data dashboard, this indicator provides a clear snapshot of the current price action across short, medium, and long-term horizons.
Whether you are a scalper looking for short-term momentum or a swing trader identifying major trend reversals, this tool simplifies the complex relationship between price and moving averages.
Key Features
1. Multi-EMA System The indicator plots four essential EMAs commonly used by institutional and retail traders:
EMA 21: Short-term trend/momentum.
EMA 55: Medium-term trend.
EMA 100: Major support/resistance level.
EMA 200: Long-term trend filter.
Visual Aid: The EMA lines change transparency automatically. They appear brighter/solid when the price is above them (bullish) and more transparent/faded when the price is below them (bearish).
2. Real-Time Information Dashboard A customizable table (displayed in the top-right corner) provides live data for the current bar:
Status: Clearly indicates if the price is "Above ▲" (Bullish) or "Below ▼" (Bearish) for each specific EMA.
Distance (%): Calculates the percentage distance between the current closing price and each EMA. This is crucial for identifying overextended moves (mean reversion opportunities) or tight consolidation.
Overall Trend Summary:
Strong ★★: Price is above all EMAs (21, 55, 100, 200).
Building ★: Price is above the long-term EMAs (55, 100, 200) but may be testing the short-term trend.
Weak ▼: Price is below all EMAs.
Ranging: Mixed signals (price is sandwiched between EMAs).
3. Custom Alerts Never miss a move. The script comes with built-in alert conditions compatible with TradingView's alert system:
Breakout Alerts: Trigger an alert when price crosses above specific EMAs (21, 55, 100, or 200).
Strong Trend Alert: Trigger an alert when the price successfully holds above all EMAs, signaling a strong bullish phase.
Settings
Show Status Table: Toggle the dashboard on or off.
Table Transparency: Adjust the background opacity of the dashboard to fit your chart theme.
Line Width: Adjust the thickness of the EMA lines for better visibility.
How to Use
Trend Following: Look for the "Strong ★★" status in the dashboard. When the price is above all EMAs and the EMAs are fanning out, it indicates a strong uptrend.
Pullbacks: If the trend is "Strong" but the price drops to test the EMA 21 or EMA 55, look for support bounces.
Mean Reversion: Watch the Distance %. If the distance becomes historically large, the price may be overextended and due for a correction back to the mean.
Consolidation: When the status shows "Ranging" and the Distance % is very low (near 0.00%), a breakout move is likely imminent.
EMA Position Alert is a comprehensive trend analysis tool designed to help traders instantly identify the market's direction and strength relative to key Exponential Moving Averages (EMAs). By combining visual trend lines with a real-time data dashboard, this indicator provides a clear snapshot of the current price action across short, medium, and long-term horizons.
Whether you are a scalper looking for short-term momentum or a swing trader identifying major trend reversals, this tool simplifies the complex relationship between price and moving averages.
Key Features
1. Multi-EMA System The indicator plots four essential EMAs commonly used by institutional and retail traders:
EMA 21: Short-term trend/momentum.
EMA 55: Medium-term trend.
EMA 100: Major support/resistance level.
EMA 200: Long-term trend filter.
Visual Aid: The EMA lines change transparency automatically. They appear brighter/solid when the price is above them (bullish) and more transparent/faded when the price is below them (bearish).
2. Real-Time Information Dashboard A customizable table (displayed in the top-right corner) provides live data for the current bar:
Status: Clearly indicates if the price is "Above ▲" (Bullish) or "Below ▼" (Bearish) for each specific EMA.
Distance (%): Calculates the percentage distance between the current closing price and each EMA. This is crucial for identifying overextended moves (mean reversion opportunities) or tight consolidation.
Overall Trend Summary:
Strong ★★: Price is above all EMAs (21, 55, 100, 200).
Building ★: Price is above the long-term EMAs (55, 100, 200) but may be testing the short-term trend.
Weak ▼: Price is below all EMAs.
Ranging: Mixed signals (price is sandwiched between EMAs).
3. Custom Alerts Never miss a move. The script comes with built-in alert conditions compatible with TradingView's alert system:
Breakout Alerts: Trigger an alert when price crosses above specific EMAs (21, 55, 100, or 200).
Strong Trend Alert: Trigger an alert when the price successfully holds above all EMAs, signaling a strong bullish phase.
Settings
Show Status Table: Toggle the dashboard on or off.
Table Transparency: Adjust the background opacity of the dashboard to fit your chart theme.
Line Width: Adjust the thickness of the EMA lines for better visibility.
How to Use
Trend Following: Look for the "Strong ★★" status in the dashboard. When the price is above all EMAs and the EMAs are fanning out, it indicates a strong uptrend.
Pullbacks: If the trend is "Strong" but the price drops to test the EMA 21 or EMA 55, look for support bounces.
Mean Reversion: Watch the Distance %. If the distance becomes historically large, the price may be overextended and due for a correction back to the mean.
Consolidation: When the status shows "Ranging" and the Distance % is very low (near 0.00%), a breakout move is likely imminent.
Phát hành các Ghi chú
# EMA Fractal Divergence
**Comprehensive Trading System: Trend, Structure & Momentum**
## 1. Overview
**EMA Fractal Divergence** is an all-in-one technical analysis tool designed to provide a complete market context at a glance. It eliminates the need for multiple indicators by fusing three critical trading concepts into a single chart overlay:
1. **Trend:** EMA Ribbon for trend direction and strength.
2. **Structure:** Swing Highs/Lows (Fractals) for Support & Resistance.
3. **Momentum:** RSI Divergence for potential reversal setups.
---
## 2. Key Features & Components
### A. The EMA Ribbon (Trend)
* **Configuration:** Displays four Exponential Moving Averages (21, 55, 100, 200).
* **EMA 21 (Orange):** Represents the short-term trend/fast line.
* **EMA 55/100/200 (Dark Gray):** Represent medium to long-term trends.
* **Visual Logic:**
* **Solid Colors:** Default setting for clear visibility.
* **Dynamic Transparency (Optional):** Can be enabled in settings. If enabled, lines become semi-transparent when price is below them to reduce visual clutter in downtrends.
* **Dashboard (Top Right):**
* Shows the real-time position of price relative to each EMA (Above ▲ / Below ▼).
* Displays the % distance between price and EMAs.
* **Overall Status:** Summarizes the trend (e.g., "Strong Bullish", "Range", "Weak").
### B. Fractal Structure (Support & Resistance)
* **Fractal Lines (Purple):** Connects significant Swing Highs and Swing Lows.
* Helps visualize market structure (Higher Highs, Lower Lows).
* Acts as dynamic support and resistance levels.
* **Key Level Dashboard (Bottom Right):**
* Displays the exact price of the most recent **Previous High** and **Previous Low**.
* Crucial for breakout or breakdown trading strategies.
### C. RSI Divergence (Momentum)
* **Signals:** Detects discrepancies between Price action and RSI momentum.
* **Green Triangle (Below Bar):** Bullish Divergence (Potential Long).
* **Red Triangle (Above Bar):** Bearish Divergence (Potential Short).
* **Visual Aid:** Draws a line connecting the pivot points on the price chart to visualize the divergence clearly.
* **Optimized Filtering:**
* **Zone Filter (Disabled by Default):** Can be enabled to only show signals when RSI is Overbought (>65) or Oversold (<35).
* **Candle Filter:** Bullish signals only appear on Green candles; Bearish signals only on Red candles.
---
## 3. Settings Guide
* **EMA Settings:** Toggle the dashboard, adjust line width, or enable "Dynamic Transparency".
* **Fractal Settings:** Show/Hide lines, change the default Purple color.
* **RSI Settings:** Adjust RSI Length (Default 14) or Pivot Lookback.
* **Alerts:** Set alerts for EMA crossovers or Divergence signals in the TradingView Alert menu.
---
## 4. How to Trade (Strategy Example)
1. **Identify Trend:** Check the EMA Dashboard. Is the status "Strong Bullish"? Are prices above the Orange EMA 21?
2. **Check Structure:** Look at the Purple Fractal lines. Is price making higher highs? Wait for a pullback to a previous Fractal Low (Support).
3. **Confirm Entry:** Look for a **Green Bullish Divergence triangle** or a bounce off the EMA 55/100.
---
### 🇨🇳 中文版:指标使用说明书
# EMA Fractal Divergence (趋势结构融合指标)
**集趋势、结构、动能于一体的综合交易系统**
## 1. 指标概述
**EMA Fractal Divergence** 是一个旨在解决“图表杂乱”问题的全能型指标。它将交易中最重要的三个维度融合在一个脚本中,帮助交易者一眼看清市场全貌:
1. **趋势 (Trend):** 通过 EMA 均线组判断方向。
2. **结构 (Structure):** 通过分型 (Fractal) 识别关键支撑阻力位。
3. **动能 (Momentum):** 通过 RSI 背离捕捉反转信号。
---
## 2. 核心功能详解
### A. EMA 均线组 (趋势判断)
* **均线配置:** 包含 4 条指数移动平均线 (21, 55, 100, 200)。
* **EMA 21 (橙色):** 短期趋势线,用于判断短期强弱。
* **EMA 55/100/200 (深灰色):** 中长期趋势线,作为重要支撑/阻力带。
* **显示逻辑:**
* **纯色显示:** 默认状态,清晰明了。
* **动态透明度 (可选):** 在设置中开启。开启后,当价格跌破均线时,均线会变淡(半透明),从而在下跌趋势中减少视觉干扰。
* **趋势面板 (右上角):**
* 实时显示当前价格在各条均线的上方还是下方。
* 显示价格距离均线的乖离率 (%)。
* **综合状态:** 自动判断当前是“强势”、“蓄势”、“震荡”还是“弱势”。
### B. 前高前低分型 (市场结构)
* **分型连线 (紫色):** 自动连接关键的波段高点和低点。
* 用于识别市场结构(如更高的高点 HH,更低的低点 LL)。
* 连线处通常是潜在的支撑或压力位。
* **价格面板 (右下角):**
* 实时显示最近一个**前高 (Previous High)** 和 **前低 (Previous Low)** 的具体价格。
* 辅助判断突破进场点或止损点。
### C. RSI 背离 (动能反转)
* **信号系统:** 自动检测价格与 RSI 指标的背离情况。
* **绿色三角 (K线下):** 看涨背离 (Bullish Div),潜在做多信号。
* **红色三角 (K线上):** 看跌背离 (Bearish Div),潜在做空信号。
* **辅助连线:** 出现信号时,会在主图画出对应的价格连线,方便复盘。
* **智能过滤:**
* **区域过滤 (默认关闭):** 旨在捕捉更多机会。如需更保守,可在设置中开启,仅检测超买(>65)/超卖(<35)区域的背离。
* **K线形态过滤:** 看涨信号必须收阳线,看跌信号必须收阴线,提高胜率。
---
## 3. 设置指南
* **EMA设置:** 可调整线条宽度、颜色,或开启/关闭“动态透明度”。
* **分型设置:** 可自定义连线颜色(默认紫色)和粗细。
* **RSI背离:** 可调整 RSI 长度(默认14)或 Pivot 回溯周期。
* **警报:** 支持添加 TradingView 警报,包括“突破均线”或“发现背离”等条件。
---
## 4. 交易策略示例 (共振交易法)
1. **顺势:** 观察右上角面板,确认处于“强势”或均线向上发散(价格在橙色线之上)。
2. **找位:** 等待价格回调至紫色分型线(前低支撑)或 灰色 EMA 均线附近。
3. **触发:** 等待出现 **绿色看涨背离三角**,或价格收盘重新站上橙色 EMA 21,即可入场。
Phát hành các Ghi chú
restoreMã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.