Bonjour, je voulais savoir s’il était possible d’avoir une autre prise de calcul du zig zag car il y a plusieurs méthodes de calcul mais je voudrais qu’il prennent en compte les plus et le plus bas car parfois certains ne sont pas pris en compte du fait que le calcul est différent donc il y a parfois des mouvements de 20 points en prenant en compte tout le mouvement sauf qu’avec les modes de calculs proposés ce mouvement est rejeté….
cordialement.
Vous pouvez utiliser ce code qui calcule le zigzag de deux manières :
1) si zzpercent=1, il effectue le calcul comme d’habitude.
2) si zzpercent=0 alors il le fait avec un canal de maximums et de minimums de X périodes.
//----------------------------------------------------------------------------//
//PRC_ZigZag
//version = 0
//26.06.24
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//----------------------------------------------------------------------------//
//-----Inputs-----------------------------------------------------------------//
ZZpercent=0
prd=15
percent=2
//----------------------------------------------------------------------------//
atr=averagetruerange[14](close) //Only drawing porpouse
//----------------------------------------------------------------------------//
//-----Pivots High&Low--------------------------------------------------------//
if ZZpercent then
//-----Mode Percent--------------------------------------------------------//
zz = zigzag[percent](close)
ph = zz<zz[1] and zz[1]>zz[2]
pl = zz>zz[1] and zz[1]<zz[2]
//-----Mode Highest/lowest Values------------------------------------------//
else
ph = high=highest[prd](high)
pl = low=lowest[prd](low)
endif
//----------------------------------------------------------------------------//
//-----Direction Calculation--------------------------------------------------//
if ph and pl=0 then
dir=1
elsif pl and ph=0 then
dir=-1
else
dir=dir
endif
dirchanged=dir<>dir[1]
//----------------------------------------------------------------------------//
//-----Calculate Arrays for each pivot----------------------------------------//
if ph or pl then
if dirchanged then
if dir=1 and not ZZpercent then
$zigzag[t+1]=highest[prd](high)
$zigzagidx[t+1]=barindex
$dir[t+1]=1
t=t+1
elsif dir=-1 and not ZZpercent then
$zigzag[t+1]=lowest[prd](low)
$zigzagidx[t+1]=barindex
$dir[t+1]=-1
t=t+1
elsif dir=1 and ZZpercent then
$zigzag[t+1]=zz[1]
$zigzagidx[t+1]=barindex[1]
$dir[t+1]=1
t=t+1
elsif dir=-1 and ZZpercent then
$zigzag[t+1]=zz[1]
$zigzagidx[t+1]=barindex[1]
$dir[t+1]=-1
t=t+1
endif
else
if not ZZpercent then
if dir=1 and highest[prd](high)> $zigzag[t] then
$zigzag[t]=highest[prd](high)
$zigzagidx[t]=barindex
elsif dir=-1 and lowest[prd](low)< $zigzag[t] then
$zigzag[t]=lowest[prd](low)
$zigzagidx[t]=barindex
endif
endif
endif
endif
//----------------------------------------------------------------------------//
//-----Drawing conditions-----------------------------------------------------//
if islastbarupdate then
//-----Last Zig and Fibonacci Levels---------------------------------------//
drawsegment($zigzagidx[max(0,t-1)],$zigzag[max(0,t-1)],$zigzagidx[t],$zigzag[t])
drawpoint($zigzagidx[max(0,t-1)],$zigzag[max(0,t-1)],2)coloured("blue",100)
drawpoint($zigzagidx[t],$zigzag[t],2)coloured("blue",100)
//-----Draw all Fibonacci levels and ZigZag-----------------------------------------//
for i=t-1 downto 1 do
//----------------------------------------------------------------------------//
drawsegment($zigzagidx[max(0,i-1)],$zigzag[max(0,i-1)],$zigzagidx[i],$zigzag[i])
drawpoint($zigzagidx[i],$zigzag[i],2)coloured("blue",100)
next
endif
return
Coucou ivan je viens de le tester il fait le calcul sur période mais je parlais de points.