Bonjour,
La constante initial (manifestement du même ordre que low, close, etc…) présente dans un indicateur codé dans une précédente version de Probuilder m’est inconnue. Bien entendu, le code ne fonctionne plus.
Y a t-il un équivalent dans le langage actuel? ou bien si je pouvais connaître sa signification pour pouvoir le programmer
Merci par avance
Sauf erreur de ma part, l’instruction ou constante “initial” n’a jamais été utilisé dans le langage de programmation de ProRealTime. Il peut s’agir d’une erreur de copier/coller ou d’une ligne de commentaire qui a été dé-commenté ?
Avec une vision du code, on pourra sans doute dépanner ce problème sans soucis 🙂
if barindex = 0 then
islong = 1
reverse = 0
af = initial
highvalue = high
lowvalue = low
prevhighvalue = high
prevlowvalue = low
mysar = lowvalue
else
highvalue = max(highvalue, high[1])
lowvalue = min(lowvalue, low[1])
if islong then
if low[1] < mysar then reverse = 1 islong = 0 endif else if high[1] > mysar then
reverse = 1
islong = 1
endif
endif
if islong then
if reverse then
mysar = lowvalue
af = 0.02
lowvalue = low[1]
highvalue = high[1]
else
if (highvalue > prevhighvalue and af < 0.2) then af = af + min(0.02, (0.2-af)) endif mysar = mysar + af * (highvalue - mysar) mysar = min(mysar, low[1]) if (barindex > 1) then
mysar = min(mysar, low[2])
endif
endif
else
if reverse then
mysar = highvalue
af = 0.02
lowvalue = low[1]
highvalue = high[1]
else
if (lowvalue < prevlowvalue and af < 0.2) then af = af + min(0.02, (0.2-af)) endif mysar = mysar + af * (lowvalue - mysar) mysar = max(mysar, high[1]) if (barindex > 1) then
mysar = max(mysar, high[2])
endif
endif
endif
prevhighvalue = highvalue
prevlowvalue = lowvalue
reverse = 0
REM anticipation du prochain cours
newhighvalue = max(highvalue, high)
newlowvalue = min(lowvalue, low)
if islong then
if low < mysar then newmysar = highvalue else if (newhighvalue > prevhighvalue and af < 0.2) then newaf = af + min(0.02, (0.2-af)) else newaf = af endif newmysar = mysar + newaf * (newhighvalue - mysar) newmysar = min(newmysar, low) newmysar = min(newmysar, low[1]) endif else if high > mysar then
newmysar = lowvalue
else
if (newlowvalue < prevlowvalue and af < 0.2) then
newaf = af + min(0.02, (0.2-af))
else
newaf = af
endif
newmysar = mysar + newaf * (newlowvalue - mysar)
newmysar = max(newmysar, high)
newmysar = max(newmysar, high[1])
endif
endif
endif
return newmysar
Merci pour la réponse, alors je ne comprends plus…il ne peut s’agir d’un commentaire, mais bien d’une définition de variable…
Il n’y a eu aucun effacement…
Merci par avance.
“initial” devait être une variable externe à renseigner avec une valeur quelconque, je lui ai ici affecté la valeur 0.02.
J’ai revu un peu le code et ça fonctionne désormais, voici le code corrigé ci-dessous et un exemple du rendu à l’écran. Cela ressemble à ce que tu souhaitais obtenir ?
once islong = 1
once reverse = 0
once af = 0.02//initial
once highvalue = high
once lowvalue = low
once prevhighvalue = high
once prevlowvalue = low
once mysar = lowvalue
if barindex>10 then
highvalue = max(highvalue, high[1])
lowvalue = min(lowvalue, low[1])
if islong then
if low[1] < mysar then
reverse = 1
islong = 0
endif
else
if high[1] > mysar then
reverse = 1
islong = 1
endif
endif
if islong then
if reverse then
mysar = lowvalue
af = 0.02
lowvalue = low[1]
highvalue = high[1]
else
if (highvalue > prevhighvalue and af < 0.2) then
af = af + min(0.02, (0.2-af))
endif
mysar = mysar + af * (highvalue - mysar)
mysar = min(mysar, low[1])
if (barindex > 1) then
mysar = min(mysar, low[2])
endif
endif
else
if reverse then
mysar = highvalue
af = 0.02
lowvalue = low[1]
highvalue = high[1]
else
if (lowvalue < prevlowvalue and af < 0.2) then
af = af + min(0.02, (0.2-af))
endif
mysar = mysar + af * (lowvalue - mysar)
mysar = max(mysar, high[1])
if (barindex > 1) then
mysar = max(mysar, high[2])
endif
endif
endif
prevhighvalue = highvalue
prevlowvalue = lowvalue
reverse = 0
REM anticipation du prochain cours
newhighvalue = max(highvalue, high)
newlowvalue = min(lowvalue, low)
if islong then
if low < mysar then
newmysar = highvalue
else
if (newhighvalue > prevhighvalue and af < 0.2) then
newaf = af + min(0.02, (0.2-af))
else
newaf = af
endif
newmysar = mysar + newaf * (newhighvalue - mysar)
newmysar = min(newmysar, low)
newmysar = min(newmysar, low[1])
endif
else
if high > mysar then
newmysar = lowvalue
else
if (newlowvalue < prevlowvalue and af < 0.2) then
newaf = af + min(0.02, (0.2-af))
else
newaf = af
endif
newmysar = mysar + newaf * (newlowvalue - mysar)
newmysar = max(newmysar, high)
newmysar = max(newmysar, high[1])
endif
endif
endif
return newmysar
Merci beaucoup!
je ne pourrai le tester que la semaine prochaine. mais ça semble OK et …mieux (je n’étais pas l’auteur)!
ravi d’avoir découvert tes compétences! Je n’en abuserai pas, mais c’est un filet de sécurité très appréciable lorsque je “sèche”.
Bien cordialement