Bonjour à tous,
ci-dessous le code de zéro trend signal.
//PRC_Zero Lag Trend Signals
//version = 0
//15.11.24
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//-------------------------------------//
//---Inputs
//-------------------------------------//
//length=70
mult=1.2
src=close
//-------------------------------------//
// Zlema calculation
//-------------------------------------//
lag=floor((length-1)/2)
myzlema=average[length,1](src+(src-src[lag]))
//-------------------------------------//
// Volatility calculation
//-------------------------------------//
atr=averagetruerange[length](close)
volatil=highest[length*3](atr)*mult
//-------------------------------------//
// Trend condition
//-------------------------------------//
once trend=0
if close crosses over myzlema+volatil then
trend=1
r=0
g=255
elsif close crosses under myzlema-volatil then
trend=-1
r=255
g=0
endif
//-------------------------------------//
// Signals and colors
//-------------------------------------//
if trend=-1 then
upper=myzlema+volatil
alpha1=90
lower=myzlema
alpha2=0
if trend<>trend[1] then
drawarrowdown(barindex,upper+0.25*atr)coloured(r,g,0,175)
endif
else
upper=myzlema
alpha1=0
lower=myzlema-volatil
alpha2=90
if trend<>trend[1] then
drawarrowup(barindex,lower-0.25*atr)coloured(0,128,0,175)
endif
endif
//if close crosses over myzlema and trend=1 and trend[1]=1 then
//drawtext("▲",barindex,myzlema-volatil*1.5)coloured("green")
//elsif close crosses under myzlema and trend=-1 and trend[1]=-1 then
//drawtext("▼",barindex,myzlema+volatil*1.5)coloured("red")
//endif
if barindex > 4*length then
colorbetween(myzlema,upper,r,g,0,alpha1)
colorbetween(myzlema,lower,r,g,0,alpha2)
endif
//-------------------------------------//
return myzlema as "Zero Lag Trends Signals"style(line,2)coloured(r,g,0)
Je recherche à incruster ce code 5 minutes dans un graphique 1 minute.
Avec timeframe(5minutes) cela ne fonctionne pas. Voir graphique
Si quelqu’un a une idée, elle sera la bienvenue….
Merci
Bonjour,
1. On voit, dans ton code, que la variable length, à la ligne 9, est commentée : elle est donc illisible/invisible pour la plateforme. Or elle est appelée dès la ligne 15, puis 17, 21 et 22. D’autres variables dépendent de cette variable, le code ne peut donc pas s’exécuter. La plateforme ne t’a-t-elle pas renvoyé un retour te demandant de définir la variable length ?
2. Pour les différences de timeframe, il faut, de mémoire, bien vérifier que le timeframe default est bien un multiple (ou sous-multiple) du timeframe dans lequel tu souhaites exécuter ton code.
Merci et bonne journée
Xavier