🔸Average Momentum Trendline for Each Timeframe
The Average Momentum Trendline feature calculates the average momentum of multiple assets over specified timeframes. It uses smoothed values to determine the momentum trend for each timeframe on the average aggregated momentum of both assets. This trendline helps traders identify the overall direction of the market momentum, providing a clearer picture of potential price movements.
🔸Real-time Divergence Indication and Alert Table
The Real-time Divergence Indications and Alert Table feature visualizes detected divergences between the momentum values of the two assets across different timeframes. It identifies both bullish and bearish divergences, signaling lagging reversals in the the following asset and potential trading opportunities. When a divergence is detected, the system generates real-time visual indications on the chart and in an overview table for traders to act promptly. The alert table provides a comprehensive overview of all detected divergences, making it easier for traders to monitor and respond to market changes.
🔸Color and Size Based Labels on Price Chart based on Divergence Type
The Color and Size Based Labels feature visually represents divergences directly on the price chart. Bullish and bearish divergences are marked with distinct colors and sizes, making them easily identifiable at a glance. Larger labels indicate higher timeframes and thus generally more significance.
🔸Identify Divergence Clusters
The more divergences align, the higher the probability of a potential trend reversal in the asset. When multiple multi-timeframe divergences occur in both lower and higher timeframes within a local cluster, the probability of a reversal increases. This is valid for both for bullish and bearish divergences.
🔸Spot Low Probability Divergences
To further increase the probability, analyze the current state of the average momentum trendline. For a bullish reversal, a relatively low level of the average momentum trendline is preferred, whereas for a bearish reversal, a relatively high level is preferred.
🔸Leading Asset
This input allows the user to select the leading asset for the divergence analysis.
🔸Following Asset
This input allows the user to select the following asset for the divergence analysis.
🔸Higher Timeframe
This input sets the higher timeframe for the analysis.
🔸Lower Timeframe
This input sets the lower timeframe for the analysis.
🔸Show RSI Divergence
This input enables or disables the display of RSI divergence signals.
🔸RSI Length
This input sets the length of the RSI calculation.
🔸RSI Source
This input sets the source data for the RSI calculation (e.g., close price).
🔸RSI Smoothing Length
This input sets the length of the smoothing applied to the RSI values.
🔸Smoothing Method
This input sets the method used for smoothing the RSI values.
The Multi-Asset Cross Timeframe Divergence Indicator (MACDI) introduces a unique approach to detecting divergences in momentum across multiple assets and timeframes simulatenously. It goes beyond traditional divergence indicators by calculating divergences not on a single asset or timeframe, but on multiple assets on multiple timeframes. It visually highlights lagging correlated asset momentum divergences, helping traders identify inefficiencies and capitalize on potential opportunities in the secondary asset.
The integration of smoothed aggregated momentum trendlines, real-time visual alerts, and divergence-based labels on price charts provides a clearer and more actionable understanding of market movements.
The MACDI serves as a comprehensive divergence detection tool that tracks momentum shifts across multiple assets and timeframes. It detects change of momentum and direction of the primary (leading) asset while the secondary (following) asset still has not changed it's momentum in it's current trend. The current momentum function used is RSI(). Future iterations of the indicator might add more momentum options such as MACD. Let's get into the details:
🔸Composite Momentum Gradient
The indicator calculates and smooths the momentum trend across multiple assets and timeframes, offering a comprehensive perspective on market momentum direction. In the initial step, the indicator computes the aggregated momentum of the selected assets and timeframes, averaging them to produce a unified measure of market momentum. A generalized formula would be:
𝑆(RSIₐᵗᶠ) = 𝒮(RSIₐᵗᶠ, Length, Method)
This means, the indicator calculates two smoothed momentum values for each asset (HTF and LTF):
- Leading Assset Highter Timeframe Momentum Value
- Following Assset Highter Timeframe Momentum Value
- Leading Assset Lower Timeframe Momentum Value
- Following Assset Lower Timeframe Momentum Value
Each of these values is smoothed based on user-defined settings, allowing for various smoothing techniques such as SMA and customizable lengths.
Subsequently, the composite gradient of both assets’ momentum for each timeframe is calculated, resulting in two series values: one for the higher timeframe (HTF) and one for the lower timeframe (LTF). These series represent the aggregated average momentum trend across both assets.
🔸Real-time Divergence Indications and Alert Table
After calculating the Composite Momentum Gradient, which serves as the foundation for trend analysis, the next objective is to identify and calculate both bullish and bearish divergences. These divergences are displayed historically and in real time, providing valuable insights for trading decisions and analysis. The divergence lookback period, denoted as "i", represents the number of bars in the past to which the current bar is compared.
Let's look at the four divergences:
- Bullish Divergence (LTF)
A bullish divergence occurs on the lower timeframe (LTF) when:
🔸The smoothed RSI of Asset1 on the LTF is greater than its value on the previous i-bars, while
🔸The smoothed RSI of Asset2 on the LTF is less than its value on the previous i-bar.
Formula:
𝑆(RSIₐ₁ˡᵗᶠ) > 𝑆(RSIₐ₁ˡᵗᶠ⁽ⁱ⁾) ∧ 𝑆(RSIₐ₂ˡᵗᶠ) < 𝑆(RSIₐ₂ˡᵗᶠ⁽ⁱ⁾)- Bearish Divergence (LTF)
A bearish divergence occurs on the lower timeframe (LTF) when:
🔸The smoothed RSI of Asset1 on the LTF is less than its value on the previous i-bars, while
🔸The smoothed RSI of Asset2 on the LTF is greater than its value on the previous i-bars.
Formula:
𝑆(RSIₐ₁ˡᵗᶠ) < 𝑆(RSIₐ₁ˡᵗᶠ⁽ⁱ⁾) ∧ 𝑆(RSIₐ₂ˡᵗᶠ) > 𝑆(RSIₐ₂ˡᵗᶠ⁽ⁱ⁾)- Bullish Divergence (HTF)
A bullish divergence occurs on the higher timeframe (HTF) when:
🔸The smoothed RSI of Asset1 on the HTF is greater than its value on the previous i-bars, while
🔸The smoothed RSI of Asset2 on the HTF is less than its value on the previous i-bars.
Formula:
𝑆(RSIₐ₁ʰᵗᶠ) > 𝑆(RSIₐ₁ʰᵗᶠ⁽ⁱ⁾) ∧ 𝑆(RSIₐ₂ʰᵗᶠ) < 𝑆(RSIₐ₂ʰᵗᶠ⁽ⁱ⁾)- Bearish Divergence (HTF)
A bearish divergence occurs on the higher timeframe (HTF) when:
🔸The smoothed RSI of Asset1 on the HTF is less than its value on the previous i-bars, while
🔸The smoothed RSI of Asset2 on the HTF is greater than its value on the previous i-bars.
Formula:
RSIₐ₁ʰᵗᶠ < RSIₐ₁ʰᵗᶠ⁽ⁱ⁾ ∧ RSIₐ₂ʰᵗᶠ > RSIₐ₂ʰᵗᶠ⁽ⁱ⁾
How to Use the Multi-Asset Cross Timeframe Divergence Indicator (MACDI)
- Identify Divergence Clusters
Look for clusters of divergences occurring across both lower and higher timeframes. A higher concentration of divergences suggests an increased probability of a trend reversal, applicable to both bullish and bearish divergences.- Spot Low Probability Divergences
Assess the Composite Gradient to gauge the likelihood of a reversal. For bullish reversals, a low value or oversold condition is favorable, while a high value or an oversold condition suggests a potential bearish reversal with higher propability.- Customize Your Settings
🔸Leading Asset & Following Asset
Select the assets for which divergences will be analyzed.
🔸Higher & Lower Timeframes
Set the preferred timeframes for the analysis.
🔸RSI Settings
Adjust the RSI divergence visibility, calculation length, source data, smoothing method and divergence offset (i) to suit your strategy.
Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.