Tracer une ligne horizontale

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #254158 quote
    Med5
    Participant
    New

    Bonjour,

    Je cherche à tracer une ligne horizontale dès que la bougie de 09h42 se clôture.
    Cette ligne doit aller immédiatement vers la droite sur environ 35 bougies, puis être finalisée exactement sur la bougie de 10h15 quand elle apparaît.

    J’avais fait un code aidé par ChatGPt mais il ne trace la ligne que quand les deux bougies sont clôturées.
    J’aimerais vraiment que la ligne apparaisse dès 09h42, puis juste qu’elle s’ajuste proprement à 10h15.

    Voici ce que je veux obtenir :

    09h42 → ligne horizontale immédiate vers la droite

    10h15 → ligne finale exacte

    fonctionnement en temps réel + historique

    Si quelqu’un peut m’aider à coder cela correctement, merci beaucoup !

    // --- Paramètres horaires ---
    ONCE startTime = 104200
    ONCE endTime   = 111500
    
    // --- Détection de la bougie de début ---
    IF time = startTime THEN
    startIndex    = barindex
    startFound    = 1
    priceAtStart  = close   // ou open / high / low de la bougie 09:42
    ENDIF
    
    // --- Détection de la bougie de fin ---
    IF time = endTime THEN
    endIndex  = barindex
    endFound  = 1
    ENDIF
    
    // --- Quand les deux sont trouvés, tracer une seule fois ---
    IF startFound = 1 AND endFound = 1 THEN
    
    // Niveau de ligne = prix de la bougie 09:42
    yLevel = priceAtStart
    
    // Ligne horizontale MAGENTA épaissie
    DRAWSEGMENT(startIndex, yLevel, endIndex, yLevel) STYLE(line,4) COLOURED(255,0,255)
    
    // Position du texte
    midIndex = (startIndex + endIndex) / 2
    
    // Texte rouge
    DRAWTEXT("10:42 - 11:15", midIndex, yLevel + 10) COLOURED(255,0,0)
    
    // Empêche le retracé
    startFound = 0
    endFound   = 0
    ENDIF
    
    RETURN
    
    #254161 quote
    JS
    Participant
    Senior

    Essaye celui-ci:

    TimeFrame(1 minute, UpdateOnClose)
    
    If OpenTime=104200 then
    xid=BarIndex
    yid=Close
    xOffSet=33 //33 minutes
    yOffSet=Range/3
    EndIf
    
    DrawSegment(xid,yid,xid+xOffSet,yid)Style(Line,4)Coloured(255,0,255)
    DrawText("10:42-11:15",xid+xOffSet/2,yid+yOffSet)Coloured(255,0,0)
    
    Return
    Med5 and Iván González thanked this post
    #254178 quote
    Med5
    Participant
    New

    Super , merci beaucoup

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

Tracer une ligne horizontale


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Med5 @adilmed10 Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Med5
2 months ago.

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