Il faut simplement enregistrer dans une variable la valeur du Volume uniquement lorsque le haut ou le bas mensuel change:
once currenthighmensuel=high
once currentlowmensuel=low
once previoushighmensuel=undefined
once previouslowmensuel=undefined
if openmonth <> openmonth[1] then
previoushighmensuel=currenthighmensuel
previouslowmensuel=currentlowmensuel
currenthighmensuel=high
currentlowmensuel=low
else
currenthighmensuel=max(high,currenthighmensuel)
currentlowmensuel=min(low,currentlowmensuel)
if currenthighmensuel<>currenthighmensuel[1] then
highvol=volume
endif
if currentlowmensuel<>currentlowmensuel[1] then
lowvol=volume
endif
endif
return highvol as "haut volume",lowvol as "bas volume", previoushighmensuel coloured(139,0,139) as "Précédent haut mensuel", previouslowmensuel coloured(139,0,139) as "Précédent bas mensuel"
(non testé)
Bonjour,
Ca ne fonctionne pas car à chaque changement même dans le mois “else” il met à jour le volume.
J’ai fais avec une boucle “while” le temps de me débloquer. Pour le moment ca rame pas trop 🙂
Oui en effet j’ai oublié de récupérer ces données au changement de mois :
once currenthighmensuel=high
once currentlowmensuel=low
once previoushighmensuel=undefined
once previouslowmensuel=undefined
if openmonth <> openmonth[1] then
previoushighmensuel=currenthighmensuel
previouslowmensuel=currentlowmensuel
currenthighmensuel=high
currentlowmensuel=low
currenthighmensuelVol=highvol
currentlowmensuelVol=lowvol
else
currenthighmensuel=max(high,currenthighmensuel)
currentlowmensuel=min(low,currentlowmensuel)
if currenthighmensuel<>currenthighmensuel[1] then
highvol=volume
endif
if currentlowmensuel<>currentlowmensuel[1] then
lowvol=volume
endif
endif
return currenthighmensuelVol as "haut volume",currentlowmensuelVol as "bas volume", previoushighmensuel coloured(139,0,139) as "Précédent haut mensuel", previouslowmensuel coloured(139,0,139) as "Précédent bas mensuel"
Non testé.
Bonjour Nicolas,
Hum me semble pas fonctionner.
Par exemple le volume bas reste le même sur plusieurs moi.
Pour le moment je suis en intraday, j’ai fais ceci :
if intradaybarindex = 0 then
maxbars= intradaybarindex[1]
i = 0
while i <> maxbars do
cond1 = (high[i] = previoushighday)
cond2 = (low[i] = previouslowday)
if cond1 then
Volprecplushaut = volume[i]
endif
if cond2 then
Volprecplusbas = volume[i]
endif
i = i+1
wend
endif
Ca fonctionne. 7
Pour les timeframe plus élevés j’affinerai ma partie openmonth afin d’aller comparer sur les X barres du mois précédent.
Pas encore essayé.
Selon moi ça fonctionne (voir image), pourvu qu’il y ait des informations de Volume pour l’instrument en question et suffisamment d’unités affichées pour constater un changement de mois. As-tu un exemple pour bien comprendre ton problème ?
Bravo pour ton code.