Bruno Carnazzi

John Ehlers MADH (Moving Average Difference - Hann) Indicator

Category: Indicators By: Bruno Carnazzi Created: January 4, 2022, 1:21 PM
January 4, 2022, 1:21 PM
Indicators
5 Comments
John Ehlers MADH (Moving Average Difference - Hann) Indicator

Last month in his October 2021 article in S&C, “Cycle/Trend Analytics And The MAD Indicator,” John Ehlers presented the MAD (moving average difference) indicator, an oscillator developed out of his research into understanding cycles data better. The MAD indicator effectively took the difference between two simple moving averages. While the MAD is said to offer an improvement over the classic, well-known MACD, the MADH (moving average difference with Hann) that Ehlers presents in his article in this issue, “The MADH: The MAD Indicator, Enhanced,” is said to offer an improvement over the MAD indicator. The enhancement comes from the utilization of the Hann windowing technique and takes the difference of two finite impulse response filters. Ehlers explains that excellent buy and sell indications can be seen in the indicator’s valleys and peaks, respectively.

// MADH (Moving Average Difference - Hann) Indicator
// (C) 2021 John F. Ehlers

//Parameters
ShortLength= 8
DominantCycle= 27

//Vars
once LongLength = 20
once Filt1 = 0
once Filt2 = 0
once coef = 0
once count = 0
once MADH = 0
once LongLength = floor(ShortLength + DominantCycle / 2)

Filt1 = 0
coef = 0
for count = 1 to ShortLength do
Filt1 = Filt1 + (1 - cos(360*count / (ShortLength + 1)))*Close[count - 1]
coef = coef + (1 - cos(360*count / (ShortLength + 1)))
next

If coef <> 0 Then
Filt1 = Filt1 / coef
endif

Filt2 = 0
coef = 0
For count = 1 to LongLength do
Filt2 = Filt2 + (1 - cos(360*count / (LongLength + 1)))*Close[count - 1]
coef = coef + (1 - cos(360*count / (LongLength + 1)))
next

If coef <> 0 Then
Filt2 = Filt2 / coef
endif

//Computed as percentage of price
If Filt2 <> 0 Then
MADH = 100*(Filt1 - Filt2) / Filt2
endif

return MADH as "MADH", 0 as "0"

Download
Filename: MADH.itf
Downloads: 174
Bruno Carnazzi
Bruno Carnazzi Senior
https://market.prorealcode.com/store/digital-filters-workshop/
Author’s Profile

Comments

DELBERT
5 years ago
#

Bonjour , merci pour votre réponse , je m'excuse je suis avec PRT v10.3 donc c'est indicateur n'est pas pour moi . Bonne journée .

DELBERT
5 years ago
#

Bonsoir , apparemment il y a une erreur de syntaxe , " Ligne 15 , Caractère 24 " . Merci pour tout ce que vous faites . Salutations .

Bruno Carnazzi
5 years ago
#

Il me semble que la fonction "floor" n'est disponible qu'avec PRT11, à vérifier

Nicolas
5 years ago
#

c'est juste, c'est une instruction très récente.

Vinks_o_7
5 years ago
#

Thanks !

ProRealCode ProRealCode
Loading...