HMA-Kahlman with Trend Indicator – Code Conversion Request

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #134565 quote
    Majellan
    Participant
    Average

    Hello,

    Could you help me with a code conversion from Pinescript to ProRealtime please? “HMA Kahlman with Trend” is a custom indicator that appears in TradingView and uses a version of the Hull Moving Average to generate buy and sell signals.

    Please see attached the Pinescript code and a screen shot of the indicator applied to US30 on the H4 timeframe.

    If you could help me to get this indicator working in PRT that would be much appreciated. If that can be done then stage 2 would be to create a strategy that generates buys and sell orders in accordance with the signals.

    Any questions please get in touch.

    Best Regards,

    Majellan.

    #134571 quote
    Nicolas
    Keymaster
    Master

    Please post all the necessary content into your post (code and picture attached), not as a Word document.

    #134579 quote
    Majellan
    Participant
    Average

    Source Code – Hull Trend with Kahlman – from TradingView

    //@version=4
    study("Hull Trend with Kahlman", shorttitle="HMA-Kahlman Trend", overlay=true)
    
    src = input(hl2, "Price Data")
    length = input(24, "Lookback")
    showcross = input(true, "Show cross over/under")
    gain = input(10000, "Gain")
    k = input(true, "Use Kahlman")
    
    hma(_src, _length) =>
    wma((2 * wma(_src, _length / 2)) - wma(_src, _length), round(sqrt(_length)))
    
    hma3(_src, _length) =>
    p = length/2
    wma(wma(close,p/3)*3 - wma(close,p/2) - wma(close,p),p)
    
    kahlman(x, g) =>
    kf = 0.0
    dk = x - nz(kf[1], x)
    smooth = nz(kf[1],x)+dk*sqrt((g/10000)*2)
    velo = 0.0
    velo := nz(velo[1],0) + ((g/10000)*dk)
    kf := smooth+velo
    
    a = k ? kahlman(hma(src, length), gain) : hma(src, length)
    b = k ? kahlman(hma3(src, length), gain) : hma3(src, length)
    c = b > a ? color.lime : color.red
    crossdn = a > b and a[1] < b[1] crossup = b > a and b[1] < a[1]
    
    p1 = plot(a,color=c,linewidth=1,transp=75)
    p2 = plot(b,color=c,linewidth=1,transp=75)
    fill(p1,p2,color=c,transp=55)
    
    plotshape(showcross and crossdn ? a : na, location=location.absolute, style=shape.labeldown, color=color.red, size=size.tiny, text="S", textcolor=color.white, transp=0, offset=-1)
    plotshape(showcross and crossup ? a : na, location=location.absolute, style=shape.labelup, color=color.green, size=size.tiny, text="B", textcolor=color.white, transp=0, offset=-1)
    #190168 quote
    zmokhtari
    Participant
    New

    Hello, i’m struggling with the conversion of this script also, have you succeded in converting it ?

    #223206 quote
    Bateson
    Participant
    New

    Bonjour

    je suis également intéressé par la conversion de cet indicateur.

    Merci par avance

    Hello I am also interested in converting this indicator. thanks in advance

    #223383 quote
    jacquesgermain
    Participant
    Senior

    Good morning,

    there seems to be a problem downloading it for inclusion in the library…

    so here is this conversion in attached files

    Msport71 thanked this post
    #223437 quote
    robertogozzi
    Moderator
    Master

    @Bateson

    Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums

    Thanks 🙂

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

HMA-Kahlman with Trend Indicator – Code Conversion Request


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Majellan @pbateson9 Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/04/2020
Status: Active
Attachments: 5 files
Logo Logo
Loading...