EMA, WEIGHTED AND WILDER AVERAGES CODE

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #61487 quote
    maximus78maximus78
    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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
    maximus78maximus78
    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
    NicolasNicolas
    Keymaster
    Legend

    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
    NicolasNicolas
    Keymaster
    Legend

    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
    maximus78maximus78
    Participant
    Senior

    Thanks so much Nicolas!

    Don’t you have also the weighted average?

    Maxx

    #61635 quote
    NicolasNicolas
    Keymaster
    Legend

    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
    NicolasNicolas
    Keymaster
    Legend

    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
    maximus78maximus78
    Participant
    Senior

    Great job Nicolas! thanks so much!

    Maxx

    #153814 quote
    Vivien AdnotVivien 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
    NicolasNicolas
    Keymaster
    Legend

    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 NicolasNicolas
5 years, 9 months ago.

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