Smoothed Moving Average
Forums › ProRealTime forum Italiano › Supporto ProBuilder › Smoothed Moving Average
- This topic has 6 replies, 3 voices, and was last updated 3 years ago by robertogozzi.
Tagged: average, Moving, smma, smoothed, Smoothed Moving Average
-
-
02/16/2021 at 7:42 PM #161702
i’m looking for the smoothed moving average (SMMA) code but i can’t find it,
i tried to figure out how to calculate it in excel and then bring it into probuilder language
but for now i haven’t had good results, can someone help me?,
thanks
02/16/2021 at 10:33 PM #16172402/17/2021 at 6:20 PM #16184002/17/2021 at 7:54 PM #161852It’s not protected, you must have done something wrong.
This is the code:
SMMA12345678Period = 20Series = CustomCloseIF BarIndex = 0 THENAFR = SeriesELSEAFR = AFR[1] + (Series - AFR[1]) / PeriodENDIFRETURN AFR AS "SMMA Smoothed Moving Average"1 user thanked author for this post.
05/12/2021 at 8:19 PM #16953005/12/2021 at 8:21 PM #16953105/13/2021 at 8:58 AM #169561You can select data sources (series) other than CLOSE with the properties (you can choose HIGH, LOW, OPEN, TYPICAL PRICE, etc…) owing to the keyword CUSTOMCLOSE.
As to shift (using past values to be plotted now) you can easily add a SHIFT variable:
123456789Period = 20 //20 periodsShift = 2 //shift the average 2 bars (cannot be < 0)Series = CustomClose //this will let you choose any other data sourceIF BarIndex < (Period + Shift) THENAFR = SeriesELSEAFR = AFR[1] + (Series - AFR[1]) / PeriodENDIFRETURN AFR[Shift] AS "SMMA Smoothed Moving Average"To shift it the other way round read https://www.prorealcode.com/topic/medie-mobili-e-cicli-di-borsa/#post-169506
1 user thanked author for this post.
-
AuthorPosts