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.
-
-
02/28/2018 at 12:17 PM #6412102/28/2018 at 8:28 PM #6414706/21/2019 at 7:53 AM #101132
This adaptive moving average in ProRealTime is the same as KAMA:
123456789101112131415161718// parameters :Period = 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 kama11/30/2019 at 7:37 PM #113972Good evening,
I have found an (the?) calculation of the AMA and coded it below in PRT.
AMA follows the actual price movements faster as KAMA does
I can mention the source where I found it if required.
Calculation AMA calculation123456789101112131415161718// Variables:Per = 10Fast = 2Slow = 30//multiplier calculationMLTP = ABS((Close - Lowest[Per](Low)) - (Highest[Per](High) - Close)) / ((Highest[Per](High) - Lowest[Per](Low)))//smoothing multiplierSC = SQUARE (MLTP * (Fast/(Fast+1) - Fast/(Slow+1)) + Fast/(Slow+1))//calculation of AMAif barindex <= Per + 1 thenAMA = closeelse//The first AMA is the close. The current AMA can be calculated using this formula:AMA = AMA[1] + SC * (Close - AMA[1])endifreturn AMA1 user thanked author for this post.
03/12/2020 at 3:40 PM #121926Hello Nicolas,
I would like to use the adaptive moving average, not on prices but on an indicator.
Is it possible to adapt the above codes by replacing “Close” with the name of the indicator?
In advance, a thousand thanks for your always precious help.
NB:
I am using V10 via IG and therefore cannot use the adaptive code [9,2,30] (close) available in V11.
Good apm
Denis
03/12/2020 at 3:46 PM #12192703/12/2020 at 3:48 PM #12192803/12/2020 at 4:04 PM #121931I already translated your French post to English so there is no need to post it again. You also posted it in the ‘Insert PRT Code’ box for some strange reason so I have deleted your last post. Please try to be more careful when posting in the forums – we like to keep them tidy! 🙂
03/12/2020 at 4:08 PM #12193303/12/2020 at 4:25 PM #121937Is it possible to adapt the above codes by replacing “Close” with the name of the indicator?
Yes it is possible, replace “Close” with the variable that contains the values of your indicator.
03/12/2020 at 4:39 PM #12193803/12/2020 at 5:18 PM #12194803/12/2020 at 5:22 PM #121949123456789101112131415161718192021222324252627282930//variable p =période de la moyenne//smooth1=période de lissage//smooth2=période du signala=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])endifreturn b1 coloured by momentum[1](b1) AS "Indicateur",0 as "Zero", kama as "Signal"////////////////////////FIN du codeHere is the code Nicolas
03/12/2020 at 5:26 PM #12195003/12/2020 at 5:37 PM #121957 -
AuthorPosts
Find exclusive trading pro-tools on