EMA, WEIGHTED AND WILDER AVERAGES CODE

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #61487 quote
    maximus78
    Participant
    Senior

    Hello guys!

    I need the probuilder codes of the EMA, WEIGHTED and WILDER averages.

    Does anybody knows them?

    Thanks in advance

    Max

    #61504 quote
    robertogozzi
    Moderator
    Master

    Proprietary software is usually undisclosed, you may try to apply PRT but I don’t think you’ll get any useful help (it would be odd if they did!).

    You may search this forum for versions that you may modify to suit your needs.

    You may also search the web for the formulas and build them on your own.

    #61509 quote
    maximus78
    Participant
    Senior

    Hi Roberto, yes I know probuilder indicators codes are not available, actually I was asking if anyone has programmed on it’s own the codes of the 3 averages to be able to modify them.

    Overall to use them as daily filter on the intraday timeframes.

    Max

    #61519 quote
    Nicolas
    Keymaster
    Master

    Exponential moving average code:

    once customema=close
    EMALength = 10
    alpha = 2/(EMALength+1)
    if barindex>EMALength then 
     CustomEMA = alpha*Close + (1-alpha)*CustomEMA[1]
    endif
    
    return customEMA
    #61520 quote
    Nicolas
    Keymaster
    Master

    Wilder Moving Average code:

    //Wilder MA
    N = 10
    K = 1/N
    if barindex>N then
     wilder = close * K + wilder[1] * (1-K)
    endif
    
    return wilder coloured(255,0,0)
    maximus78 thanked this post
    #61630 quote
    maximus78
    Participant
    Senior

    Thanks so much Nicolas!

    Don’t you have also the weighted average?

    Maxx

    #61635 quote
    Nicolas
    Keymaster
    Master

    I recoded them from scratch, don’t have time enough to code the last one yesterday. I’ll try to make it today.

    #61638 quote
    Nicolas
    Keymaster
    Master

    Weighted Moving Average code:

    period = 10
    price = customclose
    
    pricesum=0
    a=0
    for i = 0 to period do
     p=period-i 
     pricesum = pricesum+price[i]*p
     a = a + i
    next 
    
    wma = pricesum/a
    
    return wma as "wma"

    All is good now 🙂

    maximus78 thanked this post
    #61679 quote
    maximus78
    Participant
    Senior

    Great job Nicolas! thanks so much!

    Maxx

    #153814 quote
    Vivien Adnot
    Participant
    Junior

    Hello Nicolas 🙂 Thanks for the codes ! It’s really useful

    I’m wondering something about the wilder moving average code, on this line:

    wilder = close * K + wilder[1] * (1-K)

    I understand it’s a sophisticated way to make a loop,

    at the first iteration of the loop, i guess wilder is undefined, so “wilder[1] * (1-K)” should equals to “undefined * (1-K)”

    so my guess is that it is equal to 0 on the first iteration

    am I right ?

    #153816 quote
    Nicolas
    Keymaster
    Master

    Indeed, so you can add this line at the top of the code in order to get a value for the first iteration of the loop:

    once wilder = close
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.

EMA, WEIGHTED AND WILDER AVERAGES CODE


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
maximus78 @maximus78 Participant
Summary

This topic contains 10 replies,
has 4 voices, and was last updated by Nicolas
5 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/04/2018
Status: Active
Attachments: No files
Logo Logo
Loading...