Multi-Moving Average Deviation Comprehensive Indicator
Indicator Name
Multi-Moving Average Deviation Comprehensive Indicator (Short Title: Multi-MA Deviation Indicator)
**Design Concept**
This indicator is based on the deviation rates of multiple Exponential Moving Averages (EMA) to analyze market trends, overbought/oversold regions, and potential buy/sell signals. By visualizing comprehensive deviations and MACD-like signals, it provides intuitive market dynamics and deeper insights into price behavior through divergence detection.
Logic and Implementation Details
1. **Calculation of Multiple EMAs**
- Four user-defined periods (default: 20, 50, 100, 200) are used to calculate EMAs.
- Each EMA reflects the price trend over a specific timeframe.
2. **Deviation Rate Calculation**
- **Types of Deviation:**
- Deviation between closing price and EMA20:
dif20 = \frac{close}{EMA20} \times 100 - 100$
- Deviation between EMA20 and EMA50:
dif25 = \frac{EMA20}{EMA50} \times 100 - 100$
- Deviation between EMA50 and EMA100:
dif51 = \frac{EMA50}{EMA100} \times 100 - 100$
- Deviation between EMA100 and EMA200:
dif120 = \frac{EMA100}{EMA200} \times 100 - 100$
- Comprehensive Deviation Indicator (difxx):
Combines the above deviations with equal weighting to reflect the overall trend deviation.
3. **Trend Determination**
- If the comprehensive deviation (`difxx`) is positive, the market is in an uptrend.
- If `difxx` is negative, the market is in a downtrend.
4. **MACD-Like Dynamic Analysis**
- Computes the Simple Moving Average (SMA) and Exponential Moving Average (EMA) of the comprehensive deviation (`difxx`) to generate MACD-like signals.
- The histogram difference reflects market momentum changes.
- Histogram crossing from negative to positive triggers a buy signal, while crossing from positive to negative triggers a sell signal.
5. **Overbought and Oversold Regions**
- Defines dynamic overbought (`difmax`) and oversold (`difmin`) levels based on historical lowest and highest values of `difxx`.
- Values above `difmax` indicate an overbought region, and values below `difmin` indicate an oversold region.
6. **Divergence Detection**
- **Bearish Divergence:** Price makes a new high, but `difxx` does not.
- **Bullish Divergence:** Price makes a new low, but `difxx` does not.
- Divergence signals are marked on the chart for clarity.
7. **Trend Labels**
- Displays the current trend state (uptrend, downtrend, or sideways) on the chart.
How to Use
Parameter Settings
- Users can customize the following parameters to adapt to different market conditions:
- EMA periods (default: 20, 50, 100, 200)
- Length for calculating overbought and oversold levels (default: 200)
Key Signals
1. **Buy Signal**
- Triggered when the MACD histogram crosses from negative to positive.
- Buy signals in the oversold region are more reliable.
2. **Sell Signal**
- Triggered when the MACD histogram crosses from positive to negative.
- Sell signals in the overbought region carry higher risk.
3. **Trend Determination**
- Background color indicates the current trend:
- **Green Background:** Uptrend.
- **Red Background:** Downtrend.
4. **Divergence Signals**
- Bullish divergence suggests potential upward reversals.
- Bearish divergence suggests potential downward reversals.
Application Scenarios
- **Short-Term Trading:** Capture short-term reversals using overbought/oversold signals.
- **Trend Following:** Use `difxx` to identify trends and confirm them with MACD momentum.
- **Divergence Analysis:** Spot turning points in the market.
Notes
1. **Market Adaptability:**
- This indicator works best in trending markets but may produce false signals in sideways markets.
2. **Parameter Optimization:**
- Adjust EMA periods and divergence detection windows based on the characteristics of the asset being traded.
3. **Combination with Other Tools:**
- Enhance results by combining this indicator with other technical tools, such as Bollinger Bands or RSI.
This indicator allows traders to grasp market trends clearly, identify trading opportunities, and gain a deeper understanding of market behavior.
**多重移动平均线辑与使用说明**
**设计思路**
本指标基于多个指数移动平均线(EMA)的偏差率计算,用以分析市场的趋势、超买超卖区域、以及潜在的买卖信号。通过综合偏差和类似 MACD 的信号直观展现市场动态,并通过背离检测提供更深层次的价格行为洞察。
**逻辑与实现细节**
1. **多周期 EMA 计算**
- 使用四个用户自定义周期(默认分别为 20、50、100、200)计算 EMA。
- 每条 EMA 表示不同时间范围的价格趋势。
2. **偏差率计算**
- **偏差类型:**
- 收盘价与 EMA20 的偏差:dif20 = \frac{close}{EMA20} \times 100 - 100$
- EMA20 与 EMA50 的偏差:dif25 = \frac{EMA20}{EMA50} \times 100 - 100$
- EMA50 与 EMA100 的偏差:dif51 = \frac{EMA50}{EMA100} \times 100 - 100$
- EMA100 与 EMA200 的偏差:dif120 = \frac{EMA100}{EMA200} \times 100 - 100$
- 综合偏差指标(difxx):对上述偏差赋予等权重并加总,用于反映综合趋势偏离程度。
3. **趋势判定**
- 若综合偏差 `difxx` 为正,则市场处于上升趋势。
- 若综合偏差 `difxx` 为负,则市场处于下降趋势。
4. **类似 MACD 的动态分析**
- 计算综合偏差的简单移动平均线(SMA)与指数移动平均线(EMA),形成类似 MACD 的信号。
- 差值直方图表示市场动能变化。
- 直方图由负转正触发买入信号,由正转负触发卖出信号。
5. **超买和超卖区域**
- 根据历史综合偏差最低和最高值定义动态超买(difmax)和超卖(difmin)水平。
- 超过 difmax 为超买区域,低于 difmin 为超卖区域。
6. **背离检测**
- **看跌背离:**价格创新高,但 `difxx` 没有创新高。
- **看涨背离:**价格创新低,但 `difxx` 没有创新低。
- 背离信号通过图形标记提示。
7. **趋势标签**
- 显示当前趋势状态(上升趋势、下降趋势或横向盘整)在图表上。
**使用方法**
**参数设置**
- 用户可调整以下参数以适应不同市场条件:
- EMA 周期(默认 20、50、100、200)
- 超买和超卖计算的参考长度(默认 200)
**主要信号**
1. **买入信号**
- 当 MACD 直方图由负转正,标记为“买入信号”。
- 超卖区域中出现买入信号具有更高可信度。
2. **卖出信号**
- 当 MACD 直方图由正转负,标记为“卖出信号”。
- 超买区域中出现卖出信号风险较高。
3. **趋势判断**
- 图表背景颜色指示当前趋势方向:
- **绿色背景:**上升趋势。
- **红色背景:**下降趋势。
4. **背离信号**
- 看涨背离提示可能的趋势反转向上。
- 看跌背离提示可能的趋势反转向下。
**应用场景**
- **短线交易:**结合超买超卖信号捕捉短期反转。
- **趋势跟踪:**利用 difxx 趋势判断并结合 MACD 动能确认趋势延续。
- **背离分析:**用于捕捉市场转折点。
**注意事项**
1. **市场适应性:**
- 指标适用于趋势明显的市场,震荡行情中可能出现较多虚假信号。
2. **参数优化:**
- 建议根据交易标的特性调整 EMA 周期与背离检测窗口长度。
3. **配合使用:**
- 与其他技术分析工具(如布林带、RSI)结合使用效果更佳。
通过此指标,交易者可以清晰掌握市场趋势、发现买卖机会,并更全面地理解市场行为。
指标若是有什么BUG或者建议请广大粉丝留言评论。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在
使用条款阅读更多信息。