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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
// 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" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Thanks !
Bonsoir , apparemment il y a une erreur de syntaxe , ” Ligne 15 , Caractère 24 ” . Merci pour tout ce que vous faites . Salutations .
Il me semble que la fonction “floor” n’est disponible qu’avec PRT11, à vérifier
c’est juste, c’est une instruction très récente.
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 .