Bonjour
Comment identifier le changement d’état d’une variable lorsque
variable = n/d =undefined? print(variable)
Je voudrai juste récupérer le BarIndex lors du 1er changement d’état.
Merci pour vos aides.
Bien à Vous
Re-bonjour
Pour compléter ma demande, voici le code et une image-jointe.
Je souhaite obtenir le barIndex du 8 novembre 2022.
Merci de nouveau.
Bien à Vous.
periode1 = 100
Mb2 = Average[periode1](close[5])
lengthRSI = 75
lengthStoch = 75
rem --
myRSI = RSI[lengthRSI](Mb2)
MinRSI = lowest[lengthStoch](myRSI)
MaxRSI = highest[lengthStoch](myRSI)
StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)
print ( StochRSI)
return StochRSI as "StochRSI"
Je complète de nouveau.
Lorsque je passe en UT 2 jours
Je suis dans cette situation, et j’aimerai obtenir le barIndex du 6 juin 2023 (voir img1a).
Merci
Bien à vous
periode1 = 100
Mb2 = Average[periode1](close[5])
lengthRSI = 75
lengthStoch = 75
rem --
myRSI = RSI[lengthRSI](Mb2)
MinRSI = lowest[lengthStoch](myRSI)
MaxRSI = highest[lengthStoch](myRSI)
StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)
if stochRSI>=0 then
else
bar=barindex
endif
print bar
return StochRSI as "StochRSI"
J’ai ajouté un bout de code pour identifier le barIndex concerné (img2)
Merci Iván pour le solution.
periode1 = 100
Mb2 = Average[periode1](close[5])
lengthRSI = 75
lengthStoch = 75
rem --
myRSI = RSI[lengthRSI](Mb2)
MinRSI = lowest[lengthStoch](myRSI)
MaxRSI = highest[lengthStoch](myRSI)
StochRSI = (myRSI-MinRSI) / (MaxRSI-MinRSI)
if stochRSI>=0 then
else
stochRSI=0
endif
rem -----------------------------------
rem BarIndex du 1er changement d’état
if StochRSI>0 and StochRSI[1]=0 then
bar=barIndex
endif
DRAWVLINE(bar) style(DOTTEDLINE4 ,2)
return StochRSI as "StochRSI"