bonjour,
je souhaite avec le code suivant retourner le résultat du timeframe le plus élevé dans le cas (fréquent) où la condition se vérifie dans plusieurs timeframes en même temps (je me sers de criteria pour renseigner sur l’UT concernée).
Malgré l’ordre dans lequel j’ai placé les UT dans le code et le fait de préciser que si la condition est vraie en m15 (par ex) les autres ne peuvent l’être, ça ne marche pas. Une nouvelle détection apparaît et efface l’ancienne pourtant plus pertinente selon mon point de vue.
Pouvez-vous me dire si ce que je cherche à faire est possible et comment l’écrire ? merci
timeframe(15 minutes)
myincertitude = CALL incertitude
c1 = myincertitude<>0
if c1 then
c2=0 and c3=0 and c4=0 and c5=0 and c6=0
criteria=15
endif
timeframe(10 minutes)
myincertitude = CALL incertitude
c2 = myincertitude<>0
if c2 then
c3=0 and c4=0 and c5=0 and c6=0
criteria=10
endif
timeframe(5 minutes)
myincertitude = CALL incertitude
c3 = myincertitude<>0
if c3 then
c4=0 and c5=0 and c6=0
criteria=5
endif
timeframe(3 minutes)
myincertitude = CALL incertitude
c4 = myincertitude<>0
if c4 then
c5=0 and c6=0
criteria=3
endif
timeframe(2 minutes)
myincertitude = CALL incertitude
c5 = myincertitude<>0
if c5 then
c6=0
criteria=2
endif
timeframe(1 minutes)
myincertitude = CALL incertitude
c6 = myincertitude<>0
if c6 then
criteria=1
endif
condition = (c1 or c2 or c3 or c4 or c5 or c6)
screener[condition](criteria)
A tester, mais rapidement je dirai que pour chaque condition du timeframe inférieure qui suit le précédent, il faut inclure la condition que le TF supérieur n’a pas retourné sa condition, soit pour le timeframe 10 minutes par exemple (le second en partant du plus haut):
c2 = myincertitude<>0 and not c1
et ainsi de suite jusqu’au dernier TF.
merci Nicolas,
un problème subsiste : une nouvelle détection en m1 prend la main sur une ancienne en m3 par ex. Est-ce qu’il ne faut pas ajouter que tous les TFs précédents ne doivent pas avoir retourné leur condition ? j’essaie comme ça à tout hasard
Oui en effet c’est problématique puisque les valeurs des unités de temps plus petites vont changer d’état plus rapidement que celles des unités de temps plus grande. Ta solution devrait fonctionner.
Il faut l’écrire comme suit, c’est un peu lourd comme écriture mais ça marche. à noter que l’indicateur perso est très léger c’est pourquoi je ne l’ai pas écrit dans le screener.
timeframe(15 minutes)
myincertitude = CALL incertitude
c1 = myincertitude<>0
if c1 then
c2=0 and c3=0 and c4=0 and c5=0 and c6=0
criteria=15
endif
timeframe(10 minutes)
myincertitude = CALL incertitude
c2 = myincertitude<>0 and not c1
if c2 then
c3=0 and c4=0 and c5=0 and c6=0
criteria=10
endif
timeframe(5 minutes)
myincertitude = CALL incertitude
c3 = myincertitude<>0 and not c2 and not c1
if c3 then
c4=0 and c5=0 and c6=0
criteria=5
endif
timeframe(3 minutes)
myincertitude = CALL incertitude
c4 = myincertitude<>0 and not c3 and not c2 and not c1
if c4 then
c5=0 and c6=0
criteria=3
endif
timeframe(2 minutes)
myincertitude = CALL incertitude
c5 = myincertitude<>0 and not c4 and not c3 and not c2 and not c1
if c5 then
c6=0
criteria=2
endif
timeframe(1 minutes)
myincertitude = CALL incertitude
c6 = myincertitude<>0 and not c5 and not c4 and not c3 and not c2 and not c1
if c6 then
criteria=1
endif
condition = (c1 or c2 or c3 or c4 or c5 or c6)
screener[condition](criteria)