Adaptive Moving Average (AMA)
Forums › ProRealTime English forum › ProBuilder support › Adaptive Moving Average (AMA)
- This topic has 24 replies, 7 voices, and was last updated 4 years ago by mlouys.
-
-
03/12/2020 at 5:43 PM #12195903/12/2020 at 5:47 PM #12196103/12/2020 at 5:51 PM #12196503/12/2020 at 5:59 PM #121967
Try this version:
1234567891011121314151617181920212223242526272829303132333435//variable p =période de la moyenne//smooth1=période de lissage//smooth2=période du signalp = 20smooth1 = 3if barindex>p+smooth1 thena=average[p](customclose)r=round(p/2) +1b= customclose - a[r]b1=average[smooth1](b)// parameters :Period = 10FastPeriod = 2SlowPeriod = 30Fastest = 2 / (FastPeriod + 1)Slowest = 2 / (SlowPeriod + 1)if barindex < Period+1 thenKama=b1elseNum = abs(b1-b1[Period])Den = summation[Period](abs(b1-b1[1]))ER = Num / DenAlpha = SQUARE(ER *(Fastest - Slowest )+ Slowest)KAMA = (Alpha * b1) + ((1 -Alpha)* Kama[1])endifendifreturn b1 coloured by momentum[1](b1) AS "Indicateur",0 as "Zero", kama as "Signal"////////////////////////FIN du code03/12/2020 at 6:08 PM #12197003/12/2020 at 6:11 PM #12197203/12/2020 at 6:12 PM #12197303/12/2020 at 6:22 PM #12197604/19/2020 at 11:14 AM #126857Hello
When I add the kama ( or the ama) code next to the macd ZL code, I have a error message, don t know why … Here is the code
123456789101112131415161718192021222324252627282930313233343536373839404142434445//moyenne mobile adaptativePeriod = 10FastPeriod = 2SlowPeriod = 30Fastest = 2 / (FastPeriod + 1)Slowest = 2 / (SlowPeriod + 1)if barindex < Period+1 thenKama=closeelseNum = abs(close-close[Period])Den = summation[Period](abs(close-close[1]))ER = Num / DenAlpha = SQUARE(ER *(Fastest - Slowest )+ Slowest)KAMA = (Alpha * Close) + ((1 -Alpha)* Kama[1])endifreturn kama// MACD ZLag// --- settingsshort = 12long = 26signal = 9EMAshort1 = exponentialaverage[short](close)EMAshort2 = exponentialaverage[short](EMAshort1)DifferenceShort = EMAshort1 - EMAshort2ZeroLagShort = EMAshort1 + DifferenceShortEMAlong1 = exponentialaverage[long](close)EMAlong2 = exponentialaverage[long](EMAlong1)DifferenceLong = EMAlong1 - EMAlong2ZeroLagLong = EMAlong1 + DifferenceLongZeroLagMACD = ZeroLagShort - ZeroLagLongsignal1=ExponentialAverage[signal](ZEROLAGMACD)signal2=ExponentialAverage[signal](signal1)DIFFERENCE2=signal1-signal2SignalMACD=signal1+DIFFERENCE2Error message on the screen: ” erreur de syntaxe une des expressions suivantes serait plus adaptés que “short” probuilder.error.suggestion.EOF “\n” ”
An idea ? Many thanks in advance
Michel
04/19/2020 at 11:19 AM #126860 -
AuthorPosts
Find exclusive trading pro-tools on
Similar topics: