Bonjour,
Vous trouverez ci-dessous le code des différents points pivots d’un graphe journalier.
Mon problème réside dans la cloture veille . Alors que tous les points sont affichés normalement
high -1
low -1
open
open -1
le close -1 c’est n’importe quoi (afficher à 134,27 alors que la cloture est à 134,01)
defparam drawonlastbaronly = true
once currenthigh=high
once currentlow=low
once previoushigh=undefined
once previouslow=undefined
if openday <> openday[1] then
previoushigh=currenthigh
previouslow=currentlow
currenthigh=high
currentlow=low
else
currenthigh=max(high,currenthigh)
currentlow=min(low,currentlow)
endif
C1 = previoushigh - ((previoushigh-previouslow)/2)
Ht = DHigh(1)
Bs = DLow(1)
C = Dclose(1)
O = Dopen(0)
C2 = Dopen(1)
Pivot = (Ht + Bs + C) / 3
Res3 = Ht + ((Pivot - Bs)*2)
Res2 = Pivot + Ht - Bs
Res1 = (2 * Pivot) - Bs
Sup1 = (2 * Pivot) - Ht
Sup2 = Pivot - (Ht - Bs)
Sup3 = Bs - ((Ht-Pivot)*2)
//vertical offset to draw text correctly over horizontal lines
//Voffset = 1*pipsize
//draw pivot points text
DRAWTEXT("Pivot J",barindex+10,pivot,SansSerif,Bold,10)coloured(0,0,0)
DRAWTEXT ("Cloture",barindex+10,C,SansSerif,bold,10)coloured (0,0,255)
DRAWTEXT ("Open",barindex+10,O,SansSerif,bold,10)coloured (0,255,0)
DRAWTEXT("High-1",barindex+10,Ht,SansSerif,Bold,10)coloured(255,0,0)
DRAWTEXT("Low-1",barindex+10,Bs,SansSerif,Bold,10)coloured(255,0,0)
DRAWTEXT("Open-1",barindex+10,C2,Sansserif,bold,10)coloured(50,180,50)
DRAWTEXT("RES1",barindex+10,Res1,SansSerif,Bold,10)coloured(0,0,0)
DRAWTEXT("RES2",barindex+10,Res2,SansSerif,Bold,10)coloured(0,0,0)
DRAWTEXT("RES3",barindex+10,Res3,SansSerif,Bold,10)coloured(0,0,0)
DRAWTEXT("SUP1",barindex+10,Sup1,SansSerif,Bold,10)coloured(0,0,0)
DRAWTEXT("SUP2",barindex+10,Sup2,SansSerif,Bold,10)coloured(0,0,0)
DRAWTEXT("SUP3",barindex+10,Sup3,SansSerif,Bold,10)coloured(0,0,0)
return Pivot as "Point Pivot", Res1 as "R1", Res2 as "R2", Res3 as "R3", Sup1 as "S1", Sup2 as "S2", Sup3 as "S3",previoushigh as "Précédent haut journalier", previouslow as "Précédent bas journalier" ,C1 as "middle DAY",C as "Cloture veille",O as "Ouverture",C2 as "Open-1"
Un avis sur le code ?
merci