Bonjour a tous,
Je suis nouveau, fraichement arrivé sur ce forum. J’essai de monter un screener avec la fonction DONCHIAN . Mais je tombe sur un message d’erreur suivant : “” La fonction DONCHIAN retourne 7 valeurs mais votre code en a besoin de 8. “” Quand je valide la configuration de mon screnner.
Ne connaissant pas grand chose à la programmation, mais j’apprend petit à petit, j’aimerai savoir si une personne peut me donner des précision sur les éventuels modifications à faire, pour que la fonction DONCHIAN de ce code soient valider par le screener et retirer ce message d’erreur qui n’est pas très précis. J’ai cherché sur le net, et il y a peu de réponse à ce sujet.
Je vous remercie d’avance pour votre aide et vous souhaite une bonne journée à tous.
Merci.
Cordialement.
Florian.
//PRC_RSI Donchian R1 Alerts | indicator
//21.10.2022
//Nicolas @ http://www.prorealcode.com
//Sharing ProRealTime knowledge
//converted from pinescript
// — settings
rsilength = 14 //RSI Period Length
rsios =30 //RSI Oversold Level
rsiob = 70 //RSI Overbought Level
donlength = 28 //Donchian Channel Lookback Length
uSmooth = 0 //Apply MA Smoothing to RSI
matype = 7 // MA type (0=SMA,1=EMA,2=WMA,3=Wilder,4=Triangular,5=End point,6=Time series,7 = Hull (PRT v11 only),8 = ZeroLag (PRT v11 only))
malen =8 //RSI MA Smooth – Length
sBars = 0 //Colour Candles?
// — end of settings
src = customclose
// RSI calc
iRSI = rsi[rsilength](src)
// Smooth RSI if selected
if uSmooth then
maseries = average[malen,matype](iRSI)
ELSE
maseries = irsi
endif
// Calculate RSI Donchian Channel
lower = lowest[donlength](maseries)
upper = highest[donlength](maseries)
basis = (lower+upper)/2
// Look for Touches and Breaks of upper and lower channel
breakAbove = maseries >= upper[1]
breakBelow = maseries <= lower[1]
breakAboveB = maseries crosses over basis[1]
breakBelowB = maseries crosses under basis[1]
if breakabove then
trend=1
endif
if breakbelow then
trend=-1
endif
if breakaboveb or breakbelowb then
trend=0
endif
if not sbars then
if trend = 1 then
BACKGROUNDCOLOR (“green”,50)
elsif trend = -1 then
BACKGROUNDCOLOR (“red”,50)
endif
endif
colorbetween(upper,lower,”blue”,95)
if sbars then
if trend =1 then
drawcandle(open,high,low,close) coloured(“lime”)
elsif trend=-1 then
drawcandle(open,high,low,close) coloured(“pink”)
endif
endif
return maseries coloured(“dodgerred”) style(line,3) as “RSI curve”,upper coloured(“WHITE”) as “Upper DC Band”, lower coloured(“WHITE”) as “Lower DC Band”, basis coloured(“white”) style(line,3) as “DC Mid-Line”,50 style(dottedline) as “RSI Centre”,rsios style(dottedline1) coloured(“navy”) as “RSI lower boundary” , rsiob style(dottedline1) coloured(“navy”) as “RSI upper boundary”