John Ehlers roofing filter

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #33507 quote
    Francesco78
    Participant
    Master

    Hi all,

    I was tring to replicate an indicator explained by John Ehlers in a youtube video.

    I attach the formula as image.

    When I try to code it on PRT I dont get any line, I presume is because the definition of Ehlers indicator at time t refers to the same indicator at time t-1:

    Indicator:

    a = (cos(0.707*360/48)+sin(0.707*360/48)-1)/cos(0.707*360/48)
    hp = 0

    hp = (1+a/2)*(1-a/2)*(close-2*close[1]+close[2])+2*(1-a)*hp[1]-(1-a)*(1-a)*hp[2]
    return hp

     

    Can someone help with that?

    MAny thanks

    Francesco

    #33516 quote
    Francesco78
    Participant
    Master

    I guess I sorted this one by writing this

    a = (cos(0.707*360/48)+sin(0.707*360/48)-1)/cos(0.707*360/48)

    hp1 = (1+a/2)*(1-a/2)*(close[1]-2*close[2]+close[3])
    hp2 = (1+a/2)*(1-a/2)*(close[2]-2*close[3]+close[4])

    hp = (1+a/2)*(1-a/2)*(close-2*close[1]+close[2])+2*(1-a)*hp1-(1-a)*(1-a)*hp2
    return hp

     

    Do you agree?

    Many thanks

    Francesco

    #33560 quote
    gabri
    Participant
    Master

    Francesco,

     

    ecco il codice

    alpha1 = (cos(.707*360 / 48) + sin (.707*360 / 48) - 1) / cos(.707*360 / 48)
    
    if barindex>1 then
    HP = (1-alpha1/2)*(1-alpha1/2)*(Close-2*dClose(1)+dClose(2))+2*(1-alpha1)*HP[1] - (1 - alpha1)*(1 - alpha1)*HP[2]
    else
    HP = 0
    endif
    
    a1 = EXP(-1.414*3.14159 / 10)
    b1 = 2*a1*cos(1.414*180 / 10)
    c2 = b1
    c3 = -a1*a1
    c1 = 1 - c2 - c3
    
    if barindex>1 then
    Filt = c1*(hp + hp[1]) / 2 + c2*Filt[1] + c3*Filt[2]
    else
    filt=0
    endif
    return filt
    Nicolas thanked this post
    #33567 quote
    Francesco78
    Participant
    Master

    Grazie mille Gabri!

    Saluti

    Francesco

    #33721 quote
    Francesco78
    Participant
    Master

    Scusami Gabri ma continua a venire una linea pari a zero e basta, a te esce qualcosa di diverso?

    Grazie

    Francesco

    #33723 quote
    Francesco78
    Participant
    Master

    problema risolto, grazie!..:)

    #40893 quote
    gabri
    Participant
    Master

    Ok

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

John Ehlers roofing filter


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by gabri
8 years, 6 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/26/2017
Status: Active
Attachments: 1 files
Logo Logo
Loading...