TradingView
LuxAlgo
21 sie 2023 14:32

Adaptive MACD [LuxAlgo] 

Ether / United States DollarCoinbase

Opis

The Adaptive MACD indicator is an adaptive version of the popular Moving Average Convergence Divergence (MACD) oscillator, returning longer-term variations during trending markets and cyclic variations during ranging markets while filtering out noisy variations.

🔶 USAGE



The proposed oscillator contains all the elements within a regular MACD, such as a signal line and histogram. A MACD value above 0 would indicate up-trending variations, while a value under 0 would be indicating down-trending variations.



Just like most oscillators, our proposed Adaptive MACD is able to return divergences with the price.



As we can see in the image above ranging markets will make the Adaptive MACD more conservative toward more cyclical conservations, filtering out both noise and longer-term variations. However, when longer-term variations (such as in a trending market) are prominent the oscillator will conserve longer-term variations.

The R2 Period setting determines when trending/ranging markets are detected, with higher values returning indications for longer intervals.

The fast and slow settings will act similarly to the regular MACD, however, closer values will return more cyclical outputs.



The image above compares our proposed MACD (top) with a regular MACD (bottom), both using fast = 19 and slow = 20.

🔶 DETAILS

It is common to be solely interested in the trend component when the market is trending, however, during a ranging market it is more common to observe a more prominent cyclical/noise component. We want to be able to preserve one of the components at the appropriate market conditions, however, the regular MACD lack the ability to preserve cyclical component with high accuracy.

The MACD is an IIR bandpass filter. In order to obtain a lower passband bandwidth and a more symmetrical magnitude response (which would allow to conserve more precise cyclical variations) we can directly change the system calculation:

y[t] = (price[t] - price[t-1]) × g + ((1 - a1) + (1 - a2)) × y[t-1] - (1 - a1) × (1 - a2) × y[t-2]


where:

a1 = 2/(fast + 1) a2 = 2/(slow + 1) g = a1 - a2


Using division instead of multiplication on the second feedback weight allows further weighting the 2 samples lagged output, returning a more desirable magnitude response with a higher degree of filtering on both ends of the spectrum as shown in the image below:



We are interested in conserving cycles during ranging markets, and longer-term variations during trending markets, we can do this by interpolating between our two filter coefficients:

α × [(1 - a1) × (1 - a2)] + (1 - α) × [(1 - a1) / (1 - a2)]


where 1 > α > 0. α is measuring if the market is trending or ranging, with values closer to 1 indicating a trending market. We see that for higher values of α the original coefficient of the MACD is used. The image below shows various magnitude responses given multiple values of α:



We use a rolling R-Squared as α, this measurement has the benefit of indicating if the market is trending or ranging, as well as being constrained within range (0, 1), and having a U-shaped distribution.

If you are interested to learn more about the MACD see:



🔶 SETTINGS

  • R2 Period: Calculation window of the R-Squared.
  • Fast: Fast period for the calculation of the Adaptive MACD, lower values will return more noisy results.
  • Slow: Slow period for the calculation of the Adaptive MACD, higher values will return result with longer-term conserved variations.
  • Signal: Period of the EMA applied to the Adaptive MACD.
Komentarze
suvomoy17
Clean and clear Macd I ever seen ... Thank u 🙏 💐💐💐💐 Only pain is not any payment method support from India to get your premium .. If possible pls add real-time divergence in next update .. Divergence already seen in histogram and macd line but if added line it is looking very good .. Have a great Day 👍
LuxAlgo
@suvomoy17, We're glad you enjoy & thanks for the feedback, you as well!
marceloguilherme
@suvomoy17, just add the indicator Divergences for many indicators v4, from lonesometheblue and use the external indicator source from the adaptive macd.
DRDREW2020
Hello, thanks for sharing your indicators.
I am trying to understand differences in Magnitude / Strength between small and large Divergences, or between small and large Pullbacks in price.
In the SPY, QQQ and TSLA Charts below I draw divergences to MFI, MACD and Adaptive MACD.
There were 3 downtrend in prices (labeled 1, 2, 3 in Red) followed by 3 uptrends )labelled 1, 2, 3 in Green).

Why were Red #3 Downtrends in price greater than those of #1 and #2? Thank you


Trader_KingMars
In addition to liking, it is amazing! You always bring a lot of surprises to the community! Thanks!
LuxAlgo
@Trader_KingMars, Much appreciated, thanks for the comment
sachinbaringe15
This is amazing indicator
sachinbaringe15
How to apply this
davoodzamani555
Tank you
LoyaltyTrader
Please add MACD-V **ATR it's good
Więcej