Identifier les 10 derniers plus bas sur X périodes

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #188397 quote
    finplus
    Participant
    Master

    Bonjour,

    à partir de l’indicateur ci-joint que j’ai récupéré sur ce site (merci à l’auteur), je souhaiterai le compléter en identifiant par ex les 10 derniers plus bas sur les 200 dernières périodes de la valeur MM1.

    Merci d’avance.

    //
    //============================== Indicateur
    
    Trend1 = ADX[5]
    Trend2 = ADX[10]
    Trend3 = ADX[15]
    Trend4 = ADX[20]
    Trend5 = ADX[25]
    Trend6 = ADX[30]
    Trend7 = ADX[35]
    Trend8 = ADX[40]
    Trend9 = ADX[45]
    Trend10 = ADX[50]
    
    MM = average[20](close)
    Bolup = MM+STD[20]*1.0
    Boldw = MM-STD[20]*1.0
    Bol1 = MM+STD[20]*1.0
    Bol2 = MM-STD[20]*1.0
    Bol3 = MM+STD[20]*2.0
    Bol4 = MM-STD[20]*2.0
    
    CMM1 = Bol1-MM
    CMM2 = MM-Bol2
    CMM3 = Bol3-MM
    CMM4 = MM-Bol4
    
    MM0 = average[1](close)-(close)
    MM1 = average[1](MM0)+(CMM1)
    MM2 = average[1](MM0)-(CMM2)
    MM3 = average[1](MM0)+(CMM3)
    MM4 = average[1](MM0)-(CMM4)
    
    TrendT1 = Trend1 > Trend1[1]
    TrendT2 = Trend2 > Trend2[1]
    TrendT3 = Trend3 > Trend3[1]
    TrendT4 = Trend4 > Trend4[1]
    TrendT5 = Trend5 > Trend5[1]
    TrendT6 = Trend6 > Trend6[1]
    TrendT7 = Trend7 > Trend7[1]
    TrendT8 = Trend8 > Trend8[1]
    TrendT9 = Trend9 > Trend9[1]
    TrendT10 = Trend10 > Trend10[1]
    
    Trend = TrendT1 or TrendT2 or TrendT3 or TrendT4 or TrendT5 or TrendT6 or TrendT7 or TrendT8 or TrendT9 or TrendT10
    
    //============================== Trend Bullsih
    
    
    
    
    CA1 = close > MM and close > Bolup and Trend
    Bullsih = CA1
    
    if Bullsih then
    A = 1
    else
    A = 0
    endif
    
    if A = 1 then
    drawcandle(MM2,MM1,MM2,MM1)coloured(32,0,192,50)
    R = 32
    G = 0
    B = 192
    T = 250
    endif
    
    //============================== Trend Bearish
    
    CV1 = close < MM and close < Boldw and Trend
    Bearish = CV1
    
    if Bearish then
    V = 1
    else
    V = 0
    endif
    
    if V = 1 then
    drawcandle(MM1,MM2,MM1,MM2)coloured(255,0,0,50)
    R = 255
    G = 0
    B = 0
    T = 250
    endif
    
    //============================== No Trend
    
    if A = 0 and V = 0 then
    drawcandle(MM2,MM1,MM2,MM1)coloured(158,158,158,50)
    R = 158
    G = 158
    B = 158
    T = 90
    endif
    
    
    
    
    return MM0 coloured(R,G,B,T) style (line,2) as "Middle", MM1 coloured(R,G,B,T) style (line,2) as "MM1", MM2 coloured(R,G,B,T) style (line,2) as "MM2", MM3 coloured(R,G,B,T) style (line,2) as "MM3", MM4 coloured(R,G,B,T) style (line,2) as "MM4"
    #188406 quote
    Nicolas
    Keymaster
    Master

    “les 10 derniers plus bas” = dernier plus bas que quoi ? Pourrais tu définir ce qu’est un plus bas de MM1, visuellement, selon toi ?

    #188413 quote
    finplus
    Participant
    Master

    J’ai fait une copie écran annotée avec des flèches.

    Merci pour votre aide.

    Capture-décran-2022-02-17-à-17.10.38.png Capture-décran-2022-02-17-à-17.10.38.png
    #188418 quote
    finplus
    Participant
    Master

    En fait, l’idée est d’identifier les 5 distances les plus faibles mesurées par l’écart entre les MM1 et MM2 sur par exemple les 200 dernières périodes.

    #188438 quote
    Nicolas
    Keymaster
    Master

    Le code ci-dessous identifie et écrit les valeurs les plus basses de la distance entre MM1 et MM2 présents dans les 200 dernières bougies:

    defparam drawonlastbaronly=true
    //
    //============================== Indicateur
    
    Trend1 = ADX[5]
    Trend2 = ADX[10]
    Trend3 = ADX[15]
    Trend4 = ADX[20]
    Trend5 = ADX[25]
    Trend6 = ADX[30]
    Trend7 = ADX[35]
    Trend8 = ADX[40]
    Trend9 = ADX[45]
    Trend10 = ADX[50]
    
    MM = average[20](close)
    Bolup = MM+STD[20]*1.0
    Boldw = MM-STD[20]*1.0
    Bol1 = MM+STD[20]*1.0
    Bol2 = MM-STD[20]*1.0
    Bol3 = MM+STD[20]*2.0
    Bol4 = MM-STD[20]*2.0
    
    CMM1 = Bol1-MM
    CMM2 = MM-Bol2
    CMM3 = Bol3-MM
    CMM4 = MM-Bol4
    
    MM0 = average[1](close)-(close)
    MM1 = average[1](MM0)+(CMM1)
    
    $mm1[barindex]=mm1
    arraysort($mm1,descend)
    
    MM2 = average[1](MM0)-(CMM2)
    MM3 = average[1](MM0)+(CMM3)
    MM4 = average[1](MM0)-(CMM4)
    
    TrendT1 = Trend1 > Trend1[1]
    TrendT2 = Trend2 > Trend2[1]
    TrendT3 = Trend3 > Trend3[1]
    TrendT4 = Trend4 > Trend4[1]
    TrendT5 = Trend5 > Trend5[1]
    TrendT6 = Trend6 > Trend6[1]
    TrendT7 = Trend7 > Trend7[1]
    TrendT8 = Trend8 > Trend8[1]
    TrendT9 = Trend9 > Trend9[1]
    TrendT10 = Trend10 > Trend10[1]
    
    Trend = TrendT1 or TrendT2 or TrendT3 or TrendT4 or TrendT5 or TrendT6 or TrendT7 or TrendT8 or TrendT9 or TrendT10
    
    //============================== Trend Bullsih
    
    
    
    
    CA1 = close > MM and close > Bolup and Trend
    Bullsih = CA1
    
    if Bullsih then
    A = 1
    else
    A = 0
    endif
    
    if A = 1 then
    //drawcandle(MM2,MM1,MM2,MM1)coloured(32,0,192,50)
    R = 32
    G = 0
    B = 192
    T = 250
    endif
    
    //============================== Trend Bearish
    
    CV1 = close < MM and close < Boldw and Trend
    Bearish = CV1
    
    if Bearish then
    V = 1
    else
    V = 0
    endif
    
    if V = 1 then
    //drawcandle(MM1,MM2,MM1,MM2)coloured(255,0,0,50)
    R = 255
    G = 0
    B = 0
    T = 250
    endif
    
    //============================== No Trend
    
    if A = 0 and V = 0 then
    //drawcandle(MM2,MM1,MM2,MM1)coloured(158,158,158,50)
    R = 158
    G = 158
    B = 158
    T = 90
    endif
    
    $dist[barindex]=abs(mm1-mm2)
    if islastbarupdate and barindex>200 then 
    for i = 0 to 199 do 
    $array[i] = $dist[barindex-i]
    next
    arraysort($array,ascend)
    for i = 0 to 4 do
    //drawpoint($array[i],3)
    drawtext($array[i],barindex,$array[i])
    next
    endif
    
    
    return $array[0]//MM0 coloured(R,G,B,T) style (line,2) as "Middle", MM1 coloured(R,G,B,T) style (line,2) as "MM1", MM2 coloured(R,G,B,T) style (line,2) as "MM2", MM3 coloured(R,G,B,T) style (line,2) as "MM3", MM4 coloured(R,G,B,T) style (line,2) as "MM4"
    
    #188509 quote
    finplus
    Participant
    Master

    Merci pour votre aide. Bon week-end.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Identifier les 10 derniers plus bas sur X périodes


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
finplus @finplus Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by finplus
4 years ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 02/17/2022
Status: Active
Attachments: 1 files
Logo Logo
Loading...