Bonjour,
Comme illustré sur l’image attachée, je voudrais ancrer l’indicateur anchored-VWAP au point le plus haut de la journée (ici aVWAP en vert) (et un second aVWAP-Low au plus bas (aVWAP en rouge)). Et ceci de manière dynamique en intraday (départ du calcul première cotation de la journée et lorsque nouveau sommet pendant la journée alors l’ancrage change).
En pratique cela reviendrais, je pense, à fusionner les deux codes suivants trouver sur prorealcode (qui séparément et manuellement appliqués ont produit l’image) afin d’avoir un traçage automatique des aVWAP dès que l’on sélectionne une valeur :
-code Indicateurs High&Low
-Code Indicateur anchoredVWAP
Je sèche pour mettre en relation les coordonnées Highest(dhigh) (ou Lowest(dLow) récupérées dans le premier code High&Low avec les variables startDate et startTime (point d’entrée du code anchoredVWAP). Comment associer/transformer les coordonnées (High/Low) pour les insérer comme point de départ (date et Time) de l’anchored-VWAP?
Par avance merci pour tout aide.
DEFPARAM DRAWONLASTBARONLY=true
DEFPARAM CALCULATEONLASTBARS = 1000
////variables externes :
Period = 47
nb=2
If intradaybarindex then
HighestV = Highest[Period](dhigh(0))
LowestV = Lowest[Period](dlow(0))
if IsLastBarUpdate then
For j = 1 To nb do
for i = 0 To Period-1 do
IF High[period*(j-1)+i]=HighestV[(j-1)*period] Then
HighestI = BarIndex[period*(j-1)+i]
DRAWTEXT(HighestV[(j-1)*period], HighestI, HighestV[(j-1)*period]+0.5, Dialog, Standard, 12) COLOURED(0,255,0)
DRAWARROWDOWN(HighestI,HighestV[(j-1)*period]+0.25) COLOURED(0,255,00)
endif
IF Low[period*(j-1)+i]=LowestV[(j-1)*period] Then
LowestI = BarIndex[period*(j-1)+i]
DRAWTEXT(LowestV[(j-1)*period], LowestI, LowestV[(j-1)*period]-0.5, Dialog, Standard, 12) COLOURED(200,0,0)
DRAWARROWUP(LowestI,LowestV[(j-1)*period]-0.25) COLOURED(255,0,00)
endif
next
DRAWRECTANGLE(barindex[j*(period)]+1, LowestV[(j-1)*period], barindex[(j-1)*period], HighestV[(j-1)*period])
next
endif
endif
RETURN
//_________________________________HIGH-anchored-VWAP___________________
//variables externes :
startDateH = 20230317
startTimeH = 071500
//variable
highVWAP=undefined
if opendate=startDateH and opentime=startTimeH then
startbar=barindex
barcount=1
endif
if barcount>=1 then
barcount=barindex-startbar+1
d = max(1, barcount)
highVWAP = SUMMATION[d](volume*typicalprice)/SUMMATION[d](volume)
if highVWAP>highVWAP[1] then
color = 1
else
color = -1
endif
endif
RETURN highVWAP coloured by color as "highAVWAP"