Objet: adaptation d’un indicateur existant zigzag créé par Nicolas prc_fractalszigzag.itf
Fractals ZigZag
Bonjour,
Je souhaite faire apparaître le cumul de volume à chaque sommet ou creux en fonction du paramètre CP choisi.
Mes cumuls sont faux. j’ai une erreur dans mon code et je ne m’en sors pas….
Est ce que quelqu’un aurait l’amabilité de résoudre mon problème
En vous remerciant par avance
christophe
//—external parameters
//cp = 20
defparam calculateonlastbars = 400
once lastpoint = 0
if high[cp] >= highest[2*cp+1](high) then
LH = 1
else
LH = 0
endif
if low[cp] <= lowest[2*cp+1](low) then
LL = -1
else
LL = 0
endif
if LH = 1 then
TOPy = high[cp]
TOPx = barindex[cp]
endif
if LL = -1 then
BOTy = low[cp]
BOTx = barindex[cp]
endif
if LH>0 and (lastpoint=-1 or lastpoint=0) then
DRAWSEGMENT(lastX,lastY,TOPx,TOPy) COLOURED(200,0,0,255)
DRAWTEXT(“■”,TOPx,TOPy,Dialog,Bold,20) coloured(200,0,0,255)
drawtext(“#upvol#”,TOPx,TOPy*1.005) coloured (0,0,210)
lastpoint = 1
lastX = TOPx
lastY = TOPy
if lh=0 then
upvol=0
downvol=0
else
downvol=downvol+round(volume/1000)
endif
endif
if LL<0 and (lastpoint=1 or lastpoint=0) then
DRAWSEGMENT(lastX,lastY,BOTx,BOTy) COLOURED(0,200,0,255)
DRAWTEXT("■",BOTx,BOTy,Dialog,Bold,20) coloured(0,200,0,255)
drawtext("#downvol#",BOTx,BOTy*0.995) coloured (250,0,0)
lastpoint = -1
lastX = BOTx
lastY = BOTy
if ll=0 then
upvol=0
downvol=0
else
upvol=upvol+round(volume/1000)
endif
endif
RETURN