Bonjour a tous,
J’aurais besoin d’une conversion de code d’un indicateur de Tradingview.
Merci beaucoup d’avance
Voici le code:
// https://www.tradingview.com/u/ChartArt/
//
// __ __ ___ __ ___
// / ` |__| /\ |__) | /\ |__) |
// \__, | | /~~\ | \ | /~~\ | \ |
//
//
threshold = input(title=”Price Difference Threshold”, type=float, defval=0, step=0.001)
getDiff() =>
yesterday=security(tickerid, ‘D’, close[1])
today=security(tickerid, ‘D’, close)
delta=today-yesterday
percentage=delta/yesterday
closeDiff = getDiff()
buying = closeDiff > threshold ? true : closeDiff < -threshold ? false : buying[1]
hline(0, title=”zero line”)
bgcolor(buying ? green : red, transp=25)
plot(closeDiff, color=silver, style=area, transp=75)
plot(closeDiff, color=aqua, title=”prediction”)
longCondition = buying
if (longCondition)
strategy.entry(“Long”, strategy.long)
shortCondition = buying != true
if (shortCondition)
strategy.entry(“Short”, strategy.short)
Holà. Ici vous avez le code :
//-----------------------------------------//
//PRC_Percentage Change
//version = 0
//19.06.2024
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//-----------------------------------------//
//-----Inputs------------------------------//
threshold=1
//-----------------------------------------//
//-----Inputs------------------------------//
delta=close-close[1]
pctChange=delta/close[1]*100
//-----------------------------------------//
//-----Inputs------------------------------//
if pctChange > threshold then
trend=1
r=0
g=255
elsif pctChange < -threshold then
trend=-1
r=255
g=0
else
trend=trend[1]
r=r[1]
g=g[1]
endif
//-----------------------------------------//
backgroundcolor(r,g,0,50)
//-----------------------------------------//
return pctChange as "% change"style(line,2)coloured("blue"),threshold as "Threshold+"style(dottedline2)coloured("green"),-threshold as "Threshold-"style(dottedline2)coloured("red"), 0 as "Zero"