Moving Average Difference Indicator – J. Ehlers
Forums › ProRealTime forum Italiano › Supporto ProBuilder › Moving Average Difference Indicator – J. Ehlers
- This topic has 5 replies, 3 voices, and was last updated 3 years ago by robertogozzi.
Tagged: Ehlers, John, john ehlers, mad, madh
Viewing 6 posts - 1 through 6 (of 6 total)
-
-
10/22/2021 at 9:28 AM #1801411234567891011121314151617Convert to ProCODE{MAD (Moving Average Difference) Indicator(C) 2021 John F. Ehlers}Inputs:ShortLength(8),LongLength(23);Vars:MAD(0);MAD = 100*(Average(Close, ShortLength) - Average(Close, LongLength)) / Average(Close, LongLength);Plot1(MAD, "", red, 4, 4);Plot2(0,"", white, 1, 1);10/22/2021 at 9:53 AM #180150
Ok lo farò, ma per favore la prossima volta aggiungi una descrizione completa e uno screenshot del codice originale, mi aiuta molto e velocizza il processo di conversione! Questo codice è probabilmente una normalizzazione di un MACD.
10/22/2021 at 9:55 AM #180152Ecco il codice tradotto e compatibile con ProRealTime per "Moving Average Difference Indicator – J. Ehlers"
123456ShortLength=8LongLength=23MAD = 100*(Average[ShortLength] - Average[LongLength]) / Average[LongLength]RETURN MAD coloured(255,0,0) style(line,4), 010/22/2021 at 10:16 AM #18015810/22/2021 at 2:00 PM #180187MADH (Moving Average Difference - Hann) Indicator12345678910111213141516171819202122232425262728293031323334353637383940{MADH (Moving Average Difference - Hann) Indicator(C) 2021 John F. Ehlers}Inputs:ShortLength(8),DominantCycle(27);Vars:LongLength(20),Filt1(0),Filt2(0),coef(0),count(0),MADH(0);LongLength = IntPortion(ShortLength + DominantCycle / 2);Filt1 = 0;coef = 0;For count = 1 to ShortLength BeginFilt1 = Filt1 + (1 - Cosine(360*count / (ShortLength + 1)))*Close[count - 1];coef = coef + (1 - Cosine(360*count / (ShortLength + 1)));End;If coef <> 0 Then Filt1 = Filt1 / coef;Filt2 = 0;coef = 0;For count = 1 to LongLength BeginFilt2 = Filt2 + (1 - Cosine(360*count / (LongLength + 1)))*Close[count - 1];coef = coef + (1 - Cosine(360*count / (LongLength + 1)));End;If coef <> 0 Then Filt2 = Filt2 / coef;//Computed as percentage of priceIf Filt2 <> 0 Then MADH = 100*(Filt1 - Filt2) / Filt2;Plot1(MADH, "", yellow, 4, 4);Plot2(0, "", white, 1, 1);10/22/2021 at 3:37 PM #180194Eccolo:
12345678910111213141516171819202122232425262728293031// MADH indicator//// (MAD Enhanced by John Ehlers)//// https://www.tradingview.com/script/vraaRpAA-TASC-2021-11-MADH-Moving-Average-Difference-Hann///Source = closeShortLen = 8DomCycle = 27LongLen = round((DomCycle * 0.5) + ShortLen)PI = 3.14159//26535897932PIx2LongLen = PI * 2.0 / (LongLen + 1)PIx2ShortLen = PI * 2.0 / (ShortLen + 1)filt1 = 0coefs = 0FOR count = 1 TO ShortLencoefHann = 1 - cos(count * PIx2ShortLen)filt1 = filt1 + (coefHann * source[count - 1])coefs = coefs + coefHannNEXTfilt1 = filt1 / coefsfilt2 = 0coefs = 0FOR count = 1 TO LongLencoefHann = 1 - cos(count * PIx2LongLen)filt2 = filt2 + (coefHann * source[count - 1])coefs = coefs + coefHannNEXTfilt2 = filt2 / coefsMadH = (filt1 - filt2) / filt2 * 100RETURN MadH AS "MADH" -
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)