Smoothed Moving Average

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #161702 quote
    Frenkys
    Participant
    New

    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

    Calcolo-SMMA.pdf.jpg Calcolo-SMMA.pdf.jpg
    #161724 quote
    robertogozzi
    Moderator
    Master
    #161840 quote
    Frenkys
    Participant
    New

    thanks roberto,

    but when I import the file it tells me that it has already been used before

    and that it is impossible to use it again, honestly I don’t think I’ve ever used it, however, can you have a new one?

    #161852 quote
    robertogozzi
    Moderator
    Master

    It’s not protected, you must have done something wrong.

    This is the code:

    Period = 20
    Series = CustomClose
    IF BarIndex = 0 THEN
       AFR = Series
    ELSE
       AFR = AFR[1] + (Series - AFR[1]) / Period
    ENDIF
    RETURN AFR AS "SMMA Smoothed Moving Average"
    Frenkys thanked this post
    #169530 quote
    Guibourse
    Participant
    Average

    Hi ! Would you mind to tell me how to calculate this one a different way. Meaning for example : (with x periods) set the MA to high or low and shift it x bar over.

    Thanks a lot !

    #169531 quote
    Guibourse
    Participant
    Average

    To illustrate, the way we can do it here :

    Capture-decran-2021-05-12-a-21.20.23.png Capture-decran-2021-05-12-a-21.20.23.png
    #169561 quote
    robertogozzi
    Moderator
    Master

    You 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:

    Period = 20          //20 periods
    Shift  = 2           //shift the average 2 bars (cannot be < 0)
    Series = CustomClose //this will let you choose any other data source
    IF BarIndex < (Period + Shift) THEN
       AFR = Series
    ELSE
       AFR = AFR[1] + (Series - AFR[1]) / Period
    ENDIF
    RETURN 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

    Guibourse thanked this post
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Smoothed Moving Average


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Frenkys @frenkys Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by robertogozzi
4 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 02/16/2021
Status: Active
Attachments: 2 files
Logo Logo
Loading...