plus haut plus bas daily “amélioré”

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #260463 quote
    bertrandpinoy
    Participant
    Veteran

    Bien que ce sujet ait déjà été abordé, je souhaiterais ajouter une fonctionnalité supplémentaire à l’indicateur.

    Sur un graphique en timeframe 1 heure, l’indicateur affiche les plus hauts et plus bas des jours précédents sous forme de segments horizontaux fixes, qui restent affichés de manière permanente sur le graphique.

    Je souhaiterais maintenant ajouter une option dynamique pour la journée en cours :

    Lorsque le prix atteint un niveau Daily (high ou low) provenant d’un jour passé, le segment correspondant apparaît uniquement à ce moment-là sur le graphique, avec une annotation indiquant de combien de jours il date. (30 jours du passé verifié si possible).

    Exemples :

    • Nous sommes le jeudi 23 avril, et le prix atteint le plus haut daily du 5 avril → afficher un segment annoté : “Daily High – 5”
    • Si le prix atteint un plus bas daily datant de 10 jours → afficher : “Daily Low – 10”

    L’objectif est donc d’afficher uniquement les niveaux passés qui sont effectivement testés par le prix en cours de journée, avec une indication claire de leur ancienneté.

    Merci d’avance pour votre aide 🙂

    #260491 quote
    Iván González
    Moderator
    Master

    Cela pourrait ressembler à ceci.

    //-----------------------------------------------------------//
    //PRC_Dynamic Daily Highs & Lows Touch
    //version = 4
    //23.04.2026
    //Ivan Gonzalez @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //-----------------------------------------------------------//
    // Parametres
    NbDays = 30        // nombre de jours surveilles
    ShowInactive = 0   // 1 = affiche aussi en gris les niveaux non touches ; 0 = uniquement les niveaux touches
    //-----------------------------------------------------------//
    TIMEFRAME(DAILY, updateonclose)
    for iD = 0 to NbDays - 1 do
    $dh[iD] = high[iD+1]
    $dl[iD] = low[iD+1]
    next
    TIMEFRAME(default)
    //-----------------------------------------------------------//
    if barindex > 0 and OpenDay  OpenDay[1] then
    for k = NbDays - 1 downto 1 do
    $db[k] = $db[k-1]
    $touchedH[k] = $touchedH[k-1]
    $touchedL[k] = $touchedL[k-1]
    next
    $db[0] = dayStart[1]
    $touchedH[0] = 0
    $touchedL[0] = 0
    dayStart = barindex
    else
    dayStart = dayStart[1]
    endif
    //-----------------------------------------------------------//
    for i = 0 to NbDays - 1 do
    levH = $dh[i]
    levL = $dl[i]
    origin = $db[i]
    age = i + 1
       
    if ShowInactive = 1 and islastbarupdate and $touchedH[i] = 0 and levH > 0 and origin > 0 then
    DRAWSEGMENT(origin, levH, barindex, levH) COLOURED(120,120,120,30)
    endif
    if ShowInactive = 1 and islastbarupdate and $touchedL[i] = 0 and levL > 0 and origin > 0 then
    DRAWSEGMENT(origin, levL, barindex, levL) COLOURED(120,120,120,30)
    endif
       
    if $touchedH[i] = 0 and levH > 0 and origin > 0 and high >= levH and low  0 and origin > 0 and high >= levL and low <= levL then
    DRAWSEGMENT(origin, levL, barindex, levL) COLOURED(200,0,0,220)
    DRAWTEXT("Daily Low - #age#", barindex+2, levL, Dialog, Bold, 10) COLOURED(200,0,0,255)
    $touchedL[i] = 1
    endif
    next
    
    
    RETURN
    



    Nicolas thanked this post
    #260494 quote
    Nicolas
    Keymaster
    Master

    J’ai fait cette version qui affiche la dernière fois ou le daily low ou daily high a été cassé:

    // ================================================================
    // Daily High/Low Dynamic Touch - 30 jours passés
    // ================================================================
    
    DEFPARAM DrawOnLastBarOnly = true
    
    // Décalage vertical du texte (esthétique)
    tolerance = 5 * pipsize
    
    // Largeur visuelle du segment en barres
    segLen = 5
    
    drawdh=0
    drawdl = 0
    
    if intradaybarindex >= 0 then
       
       for d = 30 downto 1 do
          
          dh = DHigh(d)
          dl = DLow(d)
          if close crosses over dh and drawdh=0 then
             drawdh = dh
             drawdhOffset = d
          endif
          if close crosses under dl and drawdl=0 then
             drawdl = dl
             drawdlOffset = d
          endif
       next
       
    endif
    
    // --- Test Daily High ---
    if drawdh>0 then
       drawsegment(barindex - segLen, drawdh, barindex, drawdh) coloured(255,80,0,220)
       drawtext("Daily High - #drawdhOffset#", barindex, drawdh + tolerance) coloured(255,80,0,255)
    endif
    
    // --- Test Daily Low ---
    if drawdl>0 then
       drawsegment(barindex - segLen, drawdl, barindex, drawdl) coloured(0,100,255,220)
       drawtext("Daily Low - #drawdlOffset#", barindex, drawdl - tolerance) coloured(0,100,255,255)
    endif
    
    RETURN
    



    Iván González thanked this post
    DXSXXXX-5-minutes.png DXSXXXX-5-minutes.png
    #260570 quote
    bertrandpinoy
    Participant
    Veteran

    Merci, toujours très appréciable de pouvoir compter sur vous.

    Je joins le fichier ITF que j’utilise pour qui apprécie ce type d indicateur.

    Bon dimanche.

    Daily-level-from-past.itf
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

plus haut plus bas daily “amélioré”


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by bertrandpinoy
1 week, 2 days ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 04/23/2026
Status: Active
Attachments: 2 files
Logo Logo
Loading...