Convention script tradingview

Forums ProRealTime forum Français Support ProBuilder Convention script tradingview

Viewing 2 posts - 1 through 2 (of 2 total)
  • #239893

    Bonjour, j’espère être au bon endroit , voilà j’aimerais convertir un script tradingview pour prorealtiem, mais je n’y connais rien en code , quelqu’un pourrait m’aider, je vous mets le script en de

     

    //@version=5
    indicator(‘Ehlers Leading Indicator [CC] Ribbon’, overlay=false)
    inp = input(title=’Source’, defval=hl2)
    res = input.timeframe(title=’Resolution’, defval=”)
    rep = input(title=’Allow Repainting?’, defval=true)
    bar = input(title=’Allow Bar Color Change?’, defval=true)
    colormode = input(title=’Color Mode? [on = CheatCountry, off=BurgerCrisis]’, defval=true)
    src = request.security(syminfo.tickerid, res, inp[rep ? 0 : barstate.isrealtime ? 1 : 0])[rep ? 0 : barstate.isrealtime ? 0 : 1]
    alpha01 = input.float(title=’Alpha1 1′, defval=0.03, minval=0.01, step=0.01)
    alpha02 = input.float(title=’Alpha1 2′, defval=0.06, minval=0.01, step=0.01)
    trend = input(title=’Show Ribbon? [off = show master]’, defval=true)
    //fun(x, y) =>
    //    a = x+y
    //    b = x-y
    //    [a, b]
    //Special syntax is required for calling such functions:
    //[res0, res1] = fun(open, close)
    //plot(res0)
    //plot(res1)
    ema = 0.0
    ema := 0.5 * src + 0.5 * nz(ema[1])
    f_ehi(_alpha1, _alpha2) =>
        lead = 0.0
        lead := 2 * src + (_alpha1 – 2) * nz(src[1]) + (1 – _alpha1) * nz(lead[1])
        netLead = 0.0
        netLead := _alpha2 * lead + (1 – _alpha2) * nz(netLead[1])
        sig = netLead > ema ? 1 : netLead < ema ? -1 : 0
        liColor = sig > 0 ? color.green : sig < 0 ? color.red : color.black
        [netLead, ema, sig, liColor]
    dd = (math.pow(0.05, 1.4) + math.pow(0.05, 1.3) + math.pow(0.05, 1.2)) / 3
    [netLead0, ema0, sig0, liColor0] = f_ehi(alpha01 * 1, alpha02 * 10)
    [netLead1, ema1, sig1, liColor1] = f_ehi(alpha01 * 2, alpha02 * 9)
    [netLead2, ema2, sig2, liColor2] = f_ehi(alpha01 * 3, alpha02 * 8)
    [netLead3, ema3, sig3, liColor3] = f_ehi(alpha01 * 4, alpha02 * 7)
    [netLead4, ema4, sig4, liColor4] = f_ehi(alpha01 * 5, alpha02 * 6)
    [netLead5, ema5, sig5, liColor5] = f_ehi(alpha01 * 6, alpha02 * 5)
    [netLead6, ema6, sig6, liColor6] = f_ehi(alpha01 * 7, alpha02 * 4)
    [netLead7, ema7, sig7, liColor7] = f_ehi(alpha01 * 8, alpha02 * 3)
    [netLead8, ema8, sig8, liColor8] = f_ehi(alpha01 * 9, alpha02 * 2)
    [netLead9, ema9, sig9, liColor9] = f_ehi(alpha01 * 10, alpha02 * 1)
    alertcondition(ta.crossover(sig0, 0), ‘0 Buy Signal’, ‘0 Bullish Change Detected’)
    alertcondition(ta.crossunder(sig0, 0), ‘0 Sell Signal’, ‘0 Bearish Change Detected’)
    plot(trend ? netLead0 : na, title=’Lead 0′, color=liColor0, linewidth=2)
    plot(trend ? ema : na, title=’Ema’, color=color.new(color.black, 0), linewidth=1)
    alertcondition(ta.crossover(sig1, 0), ‘1 Buy Signal’, ‘1 Bullish Change Detected’)
    alertcondition(ta.crossunder(sig1, 0), ‘1 Sell Signal’, ‘1 Bearish Change Detected’)
    plot(trend ? netLead1 : na, title=’Lead 1′, color=liColor1, linewidth=2)
    alertcondition(ta.crossover(sig2, 0), ‘2 Buy Signal’, ‘2 Bullish Change Detected’)
    alertcondition(ta.crossunder(sig2, 0), ‘2 Sell Signal’, ‘2 Bearish Change Detected’)
    plot(trend ? netLead2 : na, title=’Lead 2′, color=liColor2, linewidth=2)
    alertcondition(ta.crossover(sig3, 0), ‘3 Buy Signal’, ‘3 Bullish Change Detected’)
    alertcondition(ta.crossunder(sig3, 0), ‘3 Sell Signal’, ‘3 Bearish Change Detected’)
    plot(trend ? netLead3 : na, title=’Lead 3′, color=liColor3, linewidth=2)
    alertcondition(ta.crossover(sig4, 0), ‘4 Buy Signal’, ‘4 Bullish Change Detected’)
    alertcondition(ta.crossunder(sig4, 0), ‘4 Sell Signal’, ‘4 Bearish Change Detected’)
    plot(trend ? netLead4 : na, title=’Lead 4′, color=liColor4, linewidth=2)
    alertcondition(ta.crossover(sig5, 0), ‘5 Buy Signal’, ‘5 Bullish Change Detected’)
    alertcondition(ta.crossunder(sig5, 0), ‘5 Sell Signal’, ‘5 Bearish Change Detected’)
    plot(trend ? netLead5 : na, title=’Lead 5′, color=liColor5, linewidth=2)
    alertcondition(ta.crossover(sig6, 0), ‘6 Buy Signal’, ‘6 Bullish Change Detected’)
    alertcondition(ta.crossunder(sig6, 0), ‘6 Sell Signal’, ‘6 Bearish Change Detected’)
    plot(trend ? netLead6 : na, title=’Lead 6′, color=liColor6, linewidth=2)
    alertcondition(ta.crossover(sig7, 0), ‘7 Buy Signal’, ‘7 Bullish Change Detected’)
    alertcondition(ta.crossunder(sig7, 0), ‘7 Sell Signal’, ‘7 Bearish Change Detected’)
    plot(trend ? netLead7 : na, title=’Lead 7′, color=liColor7, linewidth=2)
    alertcondition(ta.crossover(sig8, 0), ‘8 Buy Signal’, ‘8 Bullish Change Detected’)
    alertcondition(ta.crossunder(sig8, 0), ‘8 Sell Signal’, ‘8 Bearish Change Detected’)
    plot(trend ? netLead8 : na, title=’Lead 8′, color=liColor8, linewidth=2)
    alertcondition(ta.crossover(sig9, 0), ‘9 Buy Signal’, ‘9 Bullish Change Detected’)
    alertcondition(ta.crossunder(sig9, 0), ‘9 Sell Signal’, ‘9 Bearish Change Detected’)
    plot(trend ? netLead9 : na, title=’Lead 9′, color=liColor9, linewidth=2)
    elirating = sig0 + sig1 + sig2 + sig3 + sig4 + sig5 + sig6 + sig7 + sig8 + sig9
    sig = elirating > 0 ? elirating > nz(elirating[1]) ? 2 : 1 : elirating < 0 ? elirating < nz(elirating[1]) ? -2 : -1 : 0
    liColor = sig > 1 ? #a9ff77 : sig > 0 ? color.green : sig < -1 ? color.orange : sig < 0 ? color.red : color.gray
    trendcolor = (elirating > 5 ? #a9ff77 : elirating > 0 ? color.green : elirating < -5 ? color.orange : elirating < 0 ? color.red  : color.gray)
    colorxx = colormode ? liColor : trendcolor
    barcolor(bar ? colorxx : na)
    plot(trend ? na : elirating, title=’ELI Master Rating’, color=colorxx, linewidth=1)
    hline(trend ? na : 0, ‘dank1’)
    hline(trend ? na : 5, ‘dank2’, color.lime)
    hline(trend ? na : -5, ‘dank3’, color.orange)
    #239931

    ici vous avez

Viewing 2 posts - 1 through 2 (of 2 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login