retourner le résultat du timeframe la plus élevé

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #111072 quote
    Blondin
    Participant
    Junior

    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)
    
    #111081 quote
    Nicolas
    Keymaster
    Master

    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.

    #111090 quote
    Blondin
    Participant
    Junior

    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

    #111093 quote
    Nicolas
    Keymaster
    Master

    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.

    #111096 quote
    Blondin
    Participant
    Junior

    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)
    
    Nicolas thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

retourner le résultat du timeframe la plus élevé


ProScreener : Scanners de Marché & Détection

New Reply
Author
author-avatar
Blondin @blondin Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Blondin
6 years, 4 months ago.

Topic Details
Forum: ProScreener : Scanners de Marché & Détection
Language: French
Started: 10/24/2019
Status: Active
Attachments: No files
Logo Logo
Loading...