Convention script tradingview
Forums › ProRealTime forum Français › Support ProBuilder › Convention script tradingview
Viewing 2 posts - 1 through 2 (of 2 total)
-
-
11/01/2024 at 9:05 PM #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=5indicator(‘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.0ema := 0.5 * src + 0.5 * nz(ema[1])f_ehi(_alpha1, _alpha2) =>lead = 0.0lead := 2 * src + (_alpha1 – 2) * nz(src[1]) + (1 – _alpha1) * nz(lead[1])netLead = 0.0netLead := _alpha2 * lead + (1 – _alpha2) * nz(netLead[1])sig = netLead > ema ? 1 : netLead < ema ? -1 : 0liColor = 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 + sig9sig = elirating > 0 ? elirating > nz(elirating[1]) ? 2 : 1 : elirating < 0 ? elirating < nz(elirating[1]) ? -2 : -1 : 0liColor = sig > 1 ? #a9ff77 : sig > 0 ? color.green : sig < -1 ? color.orange : sig < 0 ? color.red : color.graytrendcolor = (elirating > 5 ? #a9ff77 : elirating > 0 ? color.green : elirating < -5 ? color.orange : elirating < 0 ? color.red : color.gray)colorxx = colormode ? liColor : trendcolorbarcolor(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)11/04/2024 at 11:40 AM #239931ici vous avez
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352//-------------------------------------------////PRC_Ehlers Leading Indicator//version = 0//04.11.2024//Iván González @ www.prorealcode.com//Sharing ProRealTime knowledge//-------------------------------------------//// Inputs//-------------------------------------------//src=customclosealpha01=0.03alpha02=0.06trend=1//-------------------------------------------//// Ema calculation//-------------------------------------------//if barindex<1 thenema=srcelseema=0.5*src+0.5*ema[1]endifdd=(pow(1.4,0.05)+pow(1.3,0.05)+pow(1.2,0.05))/3//-------------------------------------------//// NetLead0//-------------------------------------------//if barindex<1 thenlead0=0netlead0=0elselead0=2*src+(alpha01*1-2)*src[1]+(1-alpha01*1)*lead0[1]netlead0=alpha02*10*lead0+(1-alpha02*10)*netlead0[1]endifif netlead0>ema thensig0=1r00=0g00=255elseif netlead0<ema thensig0=-1r00=255g00=0elsesig0=0r00=0g00=0endifendif//-------------------------------------------//// NetLead1//-------------------------------------------//if barindex<1 thenlead1=0netlead1=0elselead1=2*src+(alpha01*2-2)*src[1]+(1-alpha01*2)*lead1[1]netlead1=alpha02*9*lead1+(1-alpha02*9)*netlead1[1]endifif netlead1>ema thensig1=1r01=0g01=255elseif netlead1<ema thensig1=-1r01=255g01=0elsesig1=0r01=0g01=0endifendif//-------------------------------------------//// NetLead2//-------------------------------------------//if barindex<1 thenlead2=0netlead2=0elselead2=2*src+(alpha01*3-2)*src[1]+(1-alpha01*3)*lead2[1]netlead2=alpha02*8*lead2+(1-alpha02*8)*netlead2[1]endifif netlead2>ema thensig2=1r02=0g02=255elseif netlead2<ema thensig2=-1r02=255g02=0elsesig2=0r02=0g02=0endifendif//-------------------------------------------//// NetLead3//-------------------------------------------//if barindex<1 thenlead3=0netlead3=0elselead3=2*src+(alpha01*4-2)*src[1]+(1-alpha01*4)*lead3[1]netlead3=alpha02*7*lead3+(1-alpha02*7)*netlead3[1]endifif netlead3>ema thensig3=1r03=0g03=255elseif netlead3<ema thensig3=-1r03=255g03=0elsesig3=0r03=0g03=0endifendif//-------------------------------------------//// NetLead4//-------------------------------------------//if barindex<1 thenlead4=0netlead4=0elselead4=2*src+(alpha01*5-2)*src[1]+(1-alpha01*5)*lead4[1]netlead4=alpha02*6*lead4+(1-alpha02*6)*netlead4[1]endifif netlead4>ema thensig4=1r04=0g04=255elseif netlead4<ema thensig4=-1r04=255g04=0elsesig4=0r04=0g04=0endifendif//-------------------------------------------//// NetLead5//-------------------------------------------//if barindex<1 thenlead5=0netlead5=0elselead5=2*src+(alpha01*6-2)*src[1]+(1-alpha01*6)*lead5[1]netlead5=alpha02*5*lead5+(1-alpha02*5)*netlead5[1]endifif netlead5>ema thensig5=1r05=0g05=255elseif netlead5<ema thensig5=-1r05=255g05=0elsesig5=0r05=0g05=0endifendif//-------------------------------------------//// NetLead6//-------------------------------------------//if barindex<1 thenlead6=0netlead6=0elselead6=2*src+(alpha01*7-2)*src[1]+(1-alpha01*7)*lead6[1]netlead6=alpha02*4*lead6+(1-alpha02*4)*netlead6[1]endifif netlead6>ema thensig6=1r06=0g06=255elseif netlead6<ema thensig6=-1r06=255g06=0elsesig6=0r06=0g06=0endifendif//-------------------------------------------//// NetLead7//-------------------------------------------//if barindex<1 thenlead7=0netlead7=0elselead7=2*src+(alpha01*8-2)*src[1]+(1-alpha01*8)*lead7[1]netlead7=alpha02*3*lead7+(1-alpha02*3)*netlead7[1]endifif netlead7>ema thensig7=1r07=0g07=255elseif netlead7<ema thensig7=-1r07=255g07=0elsesig7=0r07=0g07=0endifendif//-------------------------------------------//// NetLead8//-------------------------------------------//if barindex<1 thenlead8=0netlead8=0elselead8=2*src+(alpha01*9-2)*src[1]+(1-alpha01*9)*lead8[1]netlead8=alpha02*2*lead8+(1-alpha02*2)*netlead8[1]endifif netlead8>ema thensig8=1r08=0g08=255elseif netlead8<ema thensig8=-1r08=255g08=0elsesig8=0r08=0g08=0endifendif//-------------------------------------------//// NetLead9//-------------------------------------------//if barindex<1 thenlead9=0netlead9=0elselead9=2*src+(alpha01*10-2)*src[1]+(1-alpha01*10)*lead9[1]netlead9=alpha02*1*lead9+(1-alpha02*1)*netlead9[1]endifif netlead9>ema thensig9=1r09=0g09=255elseif netlead9<ema thensig9=-1r09=255g09=0elsesig9=0r09=0g09=0endifendif//-------------------------------------------//// ELI Master Rating//-------------------------------------------//elirating=sig0+sig1+sig2+sig3+sig4+sig5+sig6+sig7+sig8+sig9if elirating>0 thenif elirating>elirating[1] thensig=2r=169g=255b=119elsesig=1r=76g=175b=80endifelseif elirating<0 thenif elirating<elirating[1] thensig=-2r=255g=152b=0elsesig=-1r=255g=82b=82endifelsesig=0r=120g=123b=134endifendif//-------------------------------------------//// Plot conditions//-------------------------------------------//if trend thenmysig=undefinedmylead0=netlead0mylead1=netlead1mylead2=netlead2mylead3=netlead3mylead4=netlead4mylead5=netlead5mylead6=netlead6mylead7=netlead7mylead8=netlead8mylead9=netlead9myema=emaelsemysig=sigmylead0=undefinedmylead1=undefinedmylead2=undefinedmylead3=undefinedmylead4=undefinedmylead5=undefinedmylead6=undefinedmylead7=undefinedmylead8=undefinedmylead9=undefinedmyema=undefinedendif//-------------------------------------------//return mysig coloured(r,g,b),myema as "ema"coloured("black")style(line,1),mylead0 as "Lead0"coloured(r00,g00,0)style(line,2),mylead1 as "Lead1"coloured(r01,g01,0)style(line,2),mylead2 as "Lead2"coloured(r02,g02,0)style(line,2),mylead3 as "Lead3"coloured(r03,g03,0)style(line,2),mylead4 as "Lead4"coloured(r04,g04,0)style(line,2),mylead5 as "Lead5"coloured(r05,g05,0)style(line,2),mylead6 as "Lead6"coloured(r06,g06,0)style(line,2),mylead7 as "Lead7"coloured(r07,g07,0)style(line,2),mylead8 as "Lead8"coloured(r08,g08,0)style(line,2),mylead9 as "Lead9"coloured(r09,g09,0)style(line,2) -
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
Find exclusive trading pro-tools on
Similar topics: