Détection des 3 derniers plus hauts

Viewing 11 posts - 16 through 26 (of 26 total)
  • Author
    Posts
  • #195166 quote
    finplus
    Participant
    Master

    Mais je me rends compte que je devrais définir ce qui est un plus haut et un plus bas : peut-être que cela aiderait et permettrait d’éviter la “volatilité” de leur moyenne.

    #195521 quote
    finplus
    Participant
    Master

    Bonjour,

    je reviens sur ma problématique de détection des plus hauts et des plus. Je joins un graphique et le code de l’indicateur.

    Alors j’opte pour une autre solution qui serait un croisement de l’écart formé par (GuppyCTMoy – GuppyLTMoy) avec la “MA” qui estMA = average[period](data) avec les conditions suivants lorsque :

    – l’écart est positif avec un guppymoy positif et la MA au dessus du GuppyMoy –> ça c’est pour la détection haute formée par l’écart qui croise à la baisse la MA

    – l’écart est négatif avec un guppymoy négatif et la MA au dessous du GuppyMoy –> ça c’est pour la détection basse formée par l’écart qui croise à la hausse la MA

    et il ne faudrait pas que les 3 derniers croisements de façon à ne pas conserver tous les croisements et rendre le graphe illisible.

    Il faudrait que le rendu ressemble au graphe joint où j’ai ajouté manuellement une ligne représentant peu ou prou le croissement.

    Merci pour votre aide.

    a = close
    c1 = ExponentialAverage[3](a)
    c2 = ExponentialAverage[5](a)
    c3 = ExponentialAverage[8](a)
    c4 = ExponentialAverage[10](a)
    c5 = ExponentialAverage[12](a)
    c6 = ExponentialAverage[15](a)
    
    GuppyCTMoy = (c1 + c2 + c3 + c4 + c5 + c6)/6
    
    c7 = ExponentialAverage[30](a)
    c8 = ExponentialAverage[35](a)
    c9 = ExponentialAverage[40](a)
    c10 = ExponentialAverage[45](a)
    c11 = ExponentialAverage[50](a)
    c12 = ExponentialAverage[60](a)
    
    GuppyLTMoy = (c7 + c8 + c9 + c10 + c11 + c12)/6
    
    Ecart = (GuppyCTMoy - GuppyLTMoy)
    
    /////////////////////////// Paramètres de calcul de la moyenne du Guppy LT pour filtrer les entrées de position (la moyenne devant être entre le plancher et le plafond)
    
    T1 = c7 - C7[1]
    T2 = c8 - C8[1]
    T3 = c9 - C9[1]
    T4 = C10 - C10[1]
    T5 = c11 - C11[1]
    T6 = c12 - c12[1]
    
    Guppy = (T1 + T2 + T3 + T4 + T5 + T6)/6
    
    GuppyMoy = average[50](Guppy)*10
    
    if GuppyMoy<GuppyMoy[1] and GuppyMoy[1]>GuppyMoy[2] and GuppyMoy[1]>0 then
    RetB5=RetB4
    RetB4=RetB3
    RetB3=RetB2
    RetB2=RetB1
    RetB1=GuppyMoy[1]
    RetBmoy=(RetB1+RetB2+RetB3+RetB4+RetB5)/5
    endif
     
    if GuppyMoy>GuppyMoy[1] and GuppyMoy[1]<GuppyMoy[2] and GuppyMoy[1]<0 then
    RetH5=RetH4
    RetH4=RetH3
    RetH3=RetH2
    RetH2=RetH1
    RetH1=GuppyMoy[1]
    RetHmoy=(RetH1+RetH2+RetH3+RetH4+RetH5)/5
    endif
    
    
    if abs(retBmoy-0) > abs(retHmoy-0) then
    limitUP = retBmoy
    elsif abs(retBmoy-0) < abs(retHmoy-0) then
    LimitUp = -RetHmoy
    endif
    
    if abs(RetHmoy-0) > abs(RetBmoy-0) then
    limitDn = RetHmoy
    elsif abs(RetHmoy-0) < abs(RetBmoy-0) then
    LimitDn = - RetBmoy
    endif
    
    
    period = 20
    dev = 2.0
    data = Ecart
    MA = average[period](data)
    BolUp = MA+STD[period]*dev
    BolDn = MA-STD[period]*dev
    
    Return ecart as "ecart", guppymoy as "guppymoy", RetBmoy as "Moyenne 5 derniers retournements baissiers", RetHmoy as "Moyenne 5 derniers retournements haussiers", limitUp as "LimitUp", limitDn as "Limit
    
    Capture-décran-2022-06-18-à-16.02.47.png Capture-décran-2022-06-18-à-16.02.47.png
    #195978 quote
    finplus
    Participant
    Master
    a = close
    c1 = ExponentialAverage[3](a)
    c2 = ExponentialAverage[5](a)
    c3 = ExponentialAverage[8](a)
    c4 = ExponentialAverage[10](a)
    c5 = ExponentialAverage[12](a)
    c6 = ExponentialAverage[15](a)
    
    GuppyCTMoy = (c1 + c2 + c3 + c4 + c5 + c6)/6
    
    c7 = ExponentialAverage[30](a)
    c8 = ExponentialAverage[35](a)
    c9 = ExponentialAverage[40](a)
    c10 = ExponentialAverage[45](a)
    c11 = ExponentialAverage[50](a)
    c12 = ExponentialAverage[60](a)
    
    GuppyLTMoy = (c7 + c8 + c9 + c10 + c11 + c12)/6
    
    Ecart = (GuppyCTMoy - GuppyLTMoy)
    
    /////////////////////////// Paramètres de calcul de la moyenne du Guppy LT pour filtrer les entrées de position (la moyenne devant être entre le plancher et le plafond)
    
    T1 = c7 - C7[1]
    T2 = c8 - C8[1]
    T3 = c9 - C9[1]
    T4 = C10 - C10[1]
    T5 = c11 - C11[1]
    T6 = c12 - c12[1]
    
    Guppy = (T1 + T2 + T3 + T4 + T5 + T6)/6
    
    GuppyMoy = average[50](Guppy)*10
    
    if GuppyMoy<GuppyMoy[1] and GuppyMoy[1]>GuppyMoy[2] and GuppyMoy[1]>0 then
    RetB5=RetB4
    RetB4=RetB3
    RetB3=RetB2
    RetB2=RetB1
    RetB1=GuppyMoy[1]
    RetBmoy=(RetB1+RetB2+RetB3+RetB4+RetB5)/5
    endif
     
    if GuppyMoy>GuppyMoy[1] and GuppyMoy[1]<GuppyMoy[2] and GuppyMoy[1]<0 then
    RetH5=RetH4
    RetH4=RetH3
    RetH3=RetH2
    RetH2=RetH1
    RetH1=GuppyMoy[1]
    RetHmoy=(RetH1+RetH2+RetH3+RetH4+RetH5)/5
    endif
    
    
    if abs(retBmoy-0) > abs(retHmoy-0) then
    limitUP = retBmoy
    elsif abs(retBmoy-0) < abs(retHmoy-0) then
    LimitUp = -RetHmoy
    endif
    
    if abs(RetHmoy-0) > abs(RetBmoy-0) then
    limitDn = RetHmoy
    elsif abs(RetHmoy-0) < abs(RetBmoy-0) then
    LimitDn = - RetBmoy
    endif
    
    
    period = 20
    dev = 2.0
    data = Ecart
    MA = average[period](data)
    BolUp = MA+STD[period]*dev
    BolDn = MA-STD[period]*dev
     
    
    c1 = (Ecart < 0)
    c2 = (GuppyMoy < GuppyMoy[1])
    c3 = (MA < MA[1])
    c4 = (Ecart CROSSES OVER MA)
    
    
    PlafondReturnDown = -(c1 and c2 and c3 and c4)
    
    
    Return ecart as "ecart", guppymoy as "guppymoy", RetBmoy as "Moyenne 5 derniers retournements baissiers", RetHmoy as "Moyenne 5 derniers retournements haussiers", limitUp as "LimitUp", limitDn as "LimitDn", BolUp as "Boll Sup", BolDn as "Boll Inf", MA as "Boll Milieu", PlafondReturnDown as "PladondReturnDown"
    

    Bonsoir, j’ai tenté une ligne de code (c1 à c4) pour tenter d’identifier lorsque l’écart est négatif  et qu’il croise à la hausse le milieu de la bande de bollinger. J’ai joint le rendu avec le graphique où l’on voit que cela fait une sorte de zigzag (à noter toutefois que ce “zigzag” identifie correctement le croisement). Mais je voudrais en fait un rendu sous la forme d’une ligne (que j’ai tracé en bleu).  Si quelqu’un peut corriger mon code en ce sens, un grand merci.

    Capture-décran-2022-06-23-à-20.15.03.png Capture-décran-2022-06-23-à-20.15.03.png
    #196335 quote
    finplus
    Participant
    Master

    Une petite aide s’il vous plait sur mon problème ?

    Merci.

    #196338 quote
    fifi743
    Participant
    Master

    bonsoir,
    si j’ai bien compris si PlafondReturnDown est different de zero un segment est tracé ou une ligne

    #196346 quote
    finplus
    Participant
    Master

    oui ça devrait être cela. Merci. En fait, le croisement est bien identifié et je voudrais qu’il soit matérialisé par une ligne qui me donnerait en fait une sorte de plancher qui pourrait s’apparenter à un excès baissier. Et sur mon graphique, ça fait une sorte de cône ou de figure en V avec la ligne 0 puis le point de croisement et ensuite de nouveau la ligne 0. Merci.

    #196442 quote
    finplus
    Participant
    Master

    Bonjour,

    quelqu’un aurait une idée de correction SVP?

    Merci.

    #196454 quote
    Nicolas
    Keymaster
    Master

    La version du code ci-dessous trace une ligne en couleur “cyan” sur le niveau de la bollinger inférieure lorsque l’événement “PlafondReturnDown” est détecté

    defparam drawonlastbaronly=True
    
    a = close
    c1 = ExponentialAverage[3](a)
    c2 = ExponentialAverage[5](a)
    c3 = ExponentialAverage[8](a)
    c4 = ExponentialAverage[10](a)
    c5 = ExponentialAverage[12](a)
    c6 = ExponentialAverage[15](a)
    
    GuppyCTMoy = (c1 + c2 + c3 + c4 + c5 + c6)/6
    
    c7 = ExponentialAverage[30](a)
    c8 = ExponentialAverage[35](a)
    c9 = ExponentialAverage[40](a)
    c10 = ExponentialAverage[45](a)
    c11 = ExponentialAverage[50](a)
    c12 = ExponentialAverage[60](a)
    
    GuppyLTMoy = (c7 + c8 + c9 + c10 + c11 + c12)/6
    
    Ecart = (GuppyCTMoy - GuppyLTMoy)
    
    /////////////////////////// Paramètres de calcul de la moyenne du Guppy LT pour filtrer les entrées de position (la moyenne devant être entre le plancher et le plafond)
    
    T1 = c7 - C7[1]
    T2 = c8 - C8[1]
    T3 = c9 - C9[1]
    T4 = C10 - C10[1]
    T5 = c11 - C11[1]
    T6 = c12 - c12[1]
    
    Guppy = (T1 + T2 + T3 + T4 + T5 + T6)/6
    
    GuppyMoy = average[50](Guppy)*10
    
    if GuppyMoy<GuppyMoy[1] and GuppyMoy[1]>GuppyMoy[2] and GuppyMoy[1]>0 then
    RetB5=RetB4
    RetB4=RetB3
    RetB3=RetB2
    RetB2=RetB1
    RetB1=GuppyMoy[1]
    RetBmoy=(RetB1+RetB2+RetB3+RetB4+RetB5)/5
    endif
     
    if GuppyMoy>GuppyMoy[1] and GuppyMoy[1]<GuppyMoy[2] and GuppyMoy[1]<0 then
    RetH5=RetH4
    RetH4=RetH3
    RetH3=RetH2
    RetH2=RetH1
    RetH1=GuppyMoy[1]
    RetHmoy=(RetH1+RetH2+RetH3+RetH4+RetH5)/5
    endif
    
    
    if abs(retBmoy-0) > abs(retHmoy-0) then
    limitUP = retBmoy
    elsif abs(retBmoy-0) < abs(retHmoy-0) then
    LimitUp = -RetHmoy
    endif
    
    if abs(RetHmoy-0) > abs(RetBmoy-0) then
    limitDn = RetHmoy
    elsif abs(RetHmoy-0) < abs(RetBmoy-0) then
    LimitDn = - RetBmoy
    endif
    
    
    period = 20
    dev = 2.0
    data = Ecart
    MA = average[period](data)
    BolUp = MA+STD[period]*dev
    BolDn = MA-STD[period]*dev
     
    
    c1 = (Ecart < 0)
    c2 = (GuppyMoy < GuppyMoy[1])
    c3 = (MA < MA[1])
    c4 = (Ecart CROSSES OVER MA)
    
    
    PlafondReturnDown = -(c1 and c2 and c3 and c4)
    if PlafondReturnDown  then 
    palier = BolDn 
    
    endif
    if IsLastBarUpdate  then
    drawhline(palier) coloured("cyan")
    endif
    
    
    Return ecart as "ecart", guppymoy as "guppymoy", RetBmoy as "Moyenne 5 derniers retournements baissiers", RetHmoy as "Moyenne 5 derniers retournements haussiers", limitUp as "LimitUp", limitDn as "LimitDn", BolUp as "Boll Sup", BolDn as "Boll Inf", MA as "Boll Milieu"//, PlafondReturnDown as "PladondReturnDown"
    #196456 quote
    finplus
    Participant
    Master

    Merci beaucoup.

    #196493 quote
    fifi743
    Participant
    Master

    bonsoir,
    j’ai reussi a mettre un point mais pas une ligne

    a = close
    c1 = ExponentialAverage[3](a)
    c2 = ExponentialAverage[5](a)
    c3 = ExponentialAverage[8](a)
    c4 = ExponentialAverage[10](a)
    c5 = ExponentialAverage[12](a)
    c6 = ExponentialAverage[15](a)
    
    GuppyCTMoy = (c1 + c2 + c3 + c4 + c5 + c6)/6
    
    c7 = ExponentialAverage[30](a)
    c8 = ExponentialAverage[35](a)
    c9 = ExponentialAverage[40](a)
    c10 = ExponentialAverage[45](a)
    c11 = ExponentialAverage[50](a)
    c12 = ExponentialAverage[60](a)
    
    GuppyLTMoy = (c7 + c8 + c9 + c10 + c11 + c12)/6
    
    Ecart = (GuppyCTMoy - GuppyLTMoy)
    
    /////////////////////////// Paramètres de calcul de la moyenne du Guppy LT pour filtrer les entrées de position (la moyenne devant être entre le plancher et le plafond)
    
    T1 = c7 - C7[1]
    T2 = c8 - C8[1]
    T3 = c9 - C9[1]
    T4 = C10 - C10[1]
    T5 = c11 - C11[1]
    T6 = c12 - c12[1]
    
    Guppy = (T1 + T2 + T3 + T4 + T5 + T6)/6
    
    GuppyMoy = average[50](Guppy)*10
    
    if GuppyMoy<GuppyMoy[1] and GuppyMoy[1]>GuppyMoy[2] and GuppyMoy[1]>0 then
    RetB5=RetB4
    RetB4=RetB3
    RetB3=RetB2
    RetB2=RetB1
    RetB1=GuppyMoy[1]
    RetBmoy=(RetB1+RetB2+RetB3+RetB4+RetB5)/5
    endif
     
    if GuppyMoy>GuppyMoy[1] and GuppyMoy[1]<GuppyMoy[2] and GuppyMoy[1]<0 then
    RetH5=RetH4
    RetH4=RetH3
    RetH3=RetH2
    RetH2=RetH1
    RetH1=GuppyMoy[1]
    RetHmoy=(RetH1+RetH2+RetH3+RetH4+RetH5)/5
    endif
    
    
    if abs(retBmoy-0) > abs(retHmoy-0) then
    limitUP = retBmoy
    elsif abs(retBmoy-0) < abs(retHmoy-0) then
    LimitUp = -RetHmoy
    endif
    
    if abs(RetHmoy-0) > abs(RetBmoy-0) then
    limitDn = RetHmoy
    elsif abs(RetHmoy-0) < abs(RetBmoy-0) then
    LimitDn = - RetBmoy
    endif
    
    
    period = 20
    dev = 2.0
    data = Ecart
    MA = average[period](data)
    BolUp = MA+STD[period]*dev
    BolDn = MA-STD[period]*dev
     
    
    c1 = (Ecart < 0)
    c2 = (GuppyMoy < GuppyMoy[1])
    c3 = (MA < MA[1])
    c4 = (Ecart CROSSES OVER MA)
    
    
    PlafondReturnDown = -(c1 and c2 and c3 and c4)
    if PlafondReturnDown then
    DRAWPOINT(barindex, MA, 2)coloured(0,51,153)
    
    endif
    Return ecart as "ecart"coloured(204,0,51)style(histogram), guppymoy as "guppymoy", RetBmoy as "Moyenne 5 derniers retournements baissiers", RetHmoy as "Moyenne 5 derniers retournements haussiers", limitUp as "LimitUp", limitDn as "LimitDn", BolUp as "Boll Sup", BolDn as "Boll Inf", MA as "Boll Milieu"
    #196512 quote
    finplus
    Participant
    Master

    Merci. C’est exactement ça. le point se positionne sur le croisement. Reste maintenant pour moi à l’utiliser pour ne pas entrer short lorsque la bollMid est en dessous.

Viewing 11 posts - 16 through 26 (of 26 total)
  • You must be logged in to reply to this topic.

Détection des 3 derniers plus hauts


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
finplus @finplus Participant
Summary

This topic contains 25 replies,
has 4 voices, and was last updated by finplus
3 years, 8 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 05/25/2022
Status: Active
Attachments: 4 files
Logo Logo
Loading...