Conversion Ehlers Roofing Filter Indicator From MT5 to proRealTime

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #209635 quote
    Bob Harris
    Participant
    Average

    Hi ,

    Please can anyone translate the Ehlers Roofing Filter Indicator From MT5 to proReal. I have found an indicator that someone has written called Ehlers roofing Filter here https://www.prorealcode.com/topic/john-ehlers-roofing-filter/ but the results are far less accurate than the MT5 version and I don’t have the programming skills to know why. Also the MT5 version has two lines and generates signals at the crossover.

    I have attached the MQ5 File or I can cut and paste the code if that helps

     

    Many Thanks in Advance

    Bob

    #209649 quote
    Nicolas
    Keymaster
    Master

    Here is a rough conversion of the source code you provided, I don’t know why but I think there is something missing somewhere, I might investigate more later.

    once MSQRT12= 0.707106781186547524401
    once MSQRT2=1.41421356237309504880
    once MPI=3.14159265358979323846
    
    twoPiPrd = MSQRT12 * 2 * MPI / hpLength
    a1 = (Cos(twoPiPrd) + Sin(twoPiPrd) - 1) / Cos(twoPiPrd)
    a2 = Exp(-MSQRT2 * MPI / lpLength)
    beta = 2 * a2 * Cos(MSQRT2 * MPI / lpLength)
    c2 = beta
    c3 = -a2 * a2
    c1 = 1 - c2 - c3
    t1 = square(1 - (a1 / 2))
    t2 = 1 - a1
    t3 = square(t2)
    t2 = t2*2
    
    iprice=customclose
    once hp=0
    
    if barindex>hpLength then
    hp =  t1 * (iprice - 2 * iprice[1] + iprice[2]) + t2 * hp[1] - t3 * hp[2]
    
    //if rb[2]>0 then
    r1 = (rb[1])
    rr2 = (rb[2])
    //else
    //r1 = 0
    //rr2 = 0
    //endif
    
    rb = c1 * ((hp + hp[1]) / 2) + c2 * r1 + c3 * rr2
    tb = rr2
    endif
    
    if rb>0 then 
    r=0
    g=255
    else
    r=255
    g=0
    endif
    
    return rb coloured(r,g,0),tb
    GraHal thanked this post
    #209730 quote
    Bob Harris
    Participant
    Average

    Thank you Nicolas,

    You are a star

    I added the HPLength  and LpLength Variables as 80 and 40 respectively and it worked perfectly

     

    Have added the file below and I encourage folks to check it out.

    Regards

     

    Bob

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

Conversion Ehlers Roofing Filter Indicator From MT5 to proRealTime


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Bob Harris @bob_harris Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Bob Harris
2 years, 12 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/13/2023
Status: Active
Attachments: 2 files
Logo Logo
Loading...