Modification de code pour optimisation visuelle

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #248170 quote
    Med5
    Participant
    Junior

    Bonjour,

    J’aimerais simplifier ce code afin d’afficher que les lignes du High et du Low de la session en cours (Asia, London ou New York) pendant la session active uniquement (et non les sessions précédentes) et sans rectangle de remplissage, avec les paramètres horaires suivants (en heure de New York, ET) : Asia : 20h00 – 03h00 London : 03h00 – 09h30 New York : 09h30 – 17h00 ,

     Une étiquette discrète pour chaque ligne, comme “HAS”/”LAS” pour Asia, “HL”/”LL” pour London, “HNY”/”LNY” pour NY. Des couleurs distinctes : bleu (Asia), rouge (London), vert (NY).

    Je vous remercie d’avance pour votre aide pour ajuster cela!

    //----------------------------------------------//
    //PRC_ICT Killzones and Pivots
    //version = 0
    //10.10.2024
    //Iván González @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //----------------------------------------------//
    //-----INPUTS-----------------------------------//
    //----------------------------------------------//
    openAS=020000
    closeAS=060000
    openLO=080000
    closeLO=110000
    openNYam=153000
    closeNYam=170000
    openNYlch=180000
    closeNYlch=190000
    openNYpm=193000
    closeNYpm=220000
    openNY=openNYam
    closeNY=closeNYpm
    limitday=180000
    openTrueDay=060000
    
    ShowNylch=1
    
    if gettimeframe<=3600 then
    //----------------------------------------------//
    //-----ASIA Zone--------------------------------//
    //----------------------------------------------//
    once maxHighAS=high
    once minLowAS=low
    if opentime>=openAS and opentime<=closeAS then
    barAS=barAS+1
    if high>=maxHighAS then
    maxHighAS=high
    else
    maxHighAS=maxHighAS
    endif
    if low<=minLowAS then
    minLowAS=low
    else
    minLowAS=minLowAS
    endif
    endif
    if opentime=closeAS then
    drawrectangle(barindex[barAS],minLowAS,barindex,maxHighAS)coloured("blue")fillcolor("blue",30)
    drawtext("AS.H: #maxHighAS#",barindex[round(barAS/2)],maxHighAS+0.3*tr)
    drawtext("AS.L: #minLowAS#",barindex[round(barAS/2)],minLowAS-0.3*tr)
    prevLowAS=minLowAS
    prevHighAS=maxHighAS
    previdxAS=barindex
    barAS=0
    minLowAS=high*100
    maxHighAS=0
    endif
    if low crosses under prevLowAS then
    drawsegment(previdxAS,prevLowAS,barindex,prevLowAS)coloured("blue")
    prevLowAS=0
    elsif opentime=limitday and prevLowAS<>0 then
    drawsegment(previdxAS,prevLowAS,barindex,prevLowAS)coloured("blue")
    prevLowAS=0
    elsif islastbarupdate and prevLowAS<>0 then
    drawsegment(previdxAS,prevLowAS,barindex,prevLowAS)coloured("blue")
    endif
    if high crosses over prevHighAS then
    drawsegment(previdxAS,prevHighAS,barindex,prevHighAS)coloured("blue")
    prevHighAS=0
    elsif opentime=limitday and prevHighAS<>0 then
    drawsegment(previdxAS,prevHighAS,barindex,prevHighAS)coloured("blue")
    prevHighAS=0
    elsif islastbarupdate and prevHighAS<>0 then
    drawsegment(previdxAS,prevHighAS,barindex,prevHighAS)coloured("blue")
    endif
    //----------------------------------------------//
    //-----London Zone------------------------------//
    //----------------------------------------------//
    once maxHighLO=high
    once minLowLO=low
    if opentime>=openLO and opentime<=closeLO then
    barLO=barLO+1
    if high>=maxHighLO then
    maxHighLO=high
    else
    maxHighLO=maxHighLO
    endif
    if low<=minLowLO then
    minLowLO=low
    else
    minLowLO=minLowLO
    endif
    endif
    if opentime=closeLO then
    drawrectangle(barindex[barLO],minLowLO,barindex,maxHighLO)coloured("red")fillcolor("red",30)
    drawtext("LO.H: #maxHighLO#",barindex[round(barLO/2)],maxHighLO+0.3*tr)
    drawtext("LO.L: #minLowLO#",barindex[round(barLO/2)],minLowLO-0.3*tr)
    prevLowLO=minLowLO
    prevHighLO=maxHighLO
    previdxLO=barindex
    barLO=0
    minLowLO=high*100
    maxHighLO=0
    endif
    if low crosses under prevLowLO then
    drawsegment(previdxLO,prevLowLO,barindex,prevLowLO)coloured("red")
    prevLowLO=0
    elsif opentime=limitday and prevLowLO<>0 then
    drawsegment(previdxLO,prevLowLO,barindex,prevLowLO)coloured("red")
    prevLowLO=0
    elsif islastbarupdate and prevLowLO<>0 then
    drawsegment(previdxLO,prevLowLO,barindex,prevLowLO)coloured("red")
    endif
    if high crosses over prevHighLO then
    drawsegment(previdxLO,prevHighLO,barindex,prevHighLO)coloured("red")
    prevHighLO=0
    elsif opentime=limitday and prevHighLO<>0 then
    drawsegment(previdxLO,prevHighLO,barindex,prevHighLO)coloured("red")
    prevHighLO=0
    elsif islastbarupdate and prevHighLO<>0 then
    drawsegment(previdxLO,prevHighLO,barindex,prevHighLO)coloured("red")
    endif
    if ShowNylch then
    //----------------------------------------------//
    //-----New York AM------------------------------//
    //----------------------------------------------//
    once maxHighNYam=high
    once minLowNYam=low
    if opentime>=openNYam and opentime<=closeNYam then
    barNYam=barNYam+1
    if high>=maxHighNYam then
    maxHighNYam=high
    else
    maxHighNYam=maxHighNYam
    endif
    if low<=minLowNYam then
    minLowNYam=low
    else
    minLowNYam=minLowNYam
    endif
    endif
    if opentime=closeNYam then
    drawrectangle(barindex[barNYam],minLowNYam,barindex,maxHighNYam)coloured("green")fillcolor("green",30)
    drawtext("NYam.H:
    #maxHighNYam#",barindex[round(barNYam/2)],maxHighNYam+0.3*tr)
    drawtext("NYam.L:
    #minLowNYam#",barindex[round(barNYam/2)],minLowNYam-0.3*tr)
    prevLowNYam=minLowNYam
    prevHighNYam=maxHighNYam
    previdxNYam=barindex
    barNYam=0
    minLowNYam=high*100
    maxHighNYam=0
    endif
    if low crosses under prevLowNYam then
    drawsegment(previdxNYam,prevLowNYam,barindex,prevLowNYam)coloured("green")
    prevLowNYam=0
    elsif opentime=limitday and prevLowNYam<>0 then
    drawsegment(previdxNYam,prevLowNYam,barindex,prevLowNYam)coloured("green")
    prevLowNYam=0
    elsif islastbarupdate and prevLowNYam<>0 then
    drawsegment(previdxNYam,prevLowNYam,barindex,prevLowNYam)coloured("green")
    endif
    if high crosses over prevHighNYam then
    drawsegment(previdxNYam,prevHighNYam,barindex,prevHighNYam)coloured("green")
    prevHighNYam=0
    elsif opentime=limitday and prevHighNYam<>0 then
    drawsegment(previdxNYam,prevHighNYam,barindex,prevHighNYam)coloured("green")
    prevHighNYam=0
    elsif islastbarupdate and prevHighNYam<>0 then
    drawsegment(previdxNYam,prevHighNYam,barindex,prevHighNYam)coloured("green")
    endif
    //----------------------------------------------//
    //-----New York lunch Zone----------------------//
    //----------------------------------------------//
    once maxHighNYlch=high
    once minLowNYlch=low
    if opentime>=openNYlch and opentime<=closeNYlch then
    barNYlch=barNYlch+1
    if high>=maxHighNYlch then
    maxHighNYlch=high
    else
    maxHighNYlch=maxHighNYlch
    endif
    if low<=minLowNYlch then
    minLowNYlch=low
    else
    minLowNYlch=minLowNYlch
    endif
    endif
    if opentime=closeNYlch then
    drawrectangle(barindex[barNYlch],minLowNYlch,barindex,maxHighNYlch)coloured("yellow")fillcolor("yellow",30)
    prevLowNYlch=minLowNYlch
    prevHighNYlch=maxHighNYlch
    previdxNYlch=barindex
    barNYlch=0
    minLowNYlch=high*100
    maxHighNYlch=0
    endif
    //----------------------------------------------//
    //-----New York PM -----------------------------//
    //----------------------------------------------//
    once maxHighNYpm=high
    once minLowNYpm=low
    if opentime>=openNYpm and opentime<=closeNYpm then
    barNYpm=barNYpm+1
    if high>=maxHighNYpm then
    maxHighNYpm=high
    else
    maxHighNYpm=maxHighNYpm
    endif
    if low<=minLowNYpm then
    minLowNYpm=low
    else
    minLowNYpm=minLowNYpm
    endif
    endif
    if opentime=closeNYpm then
    drawrectangle(barindex[barNYpm],minLowNYpm,barindex,maxHighNYpm)coloured("purple")fillcolor("purple",30)
    drawtext("NYpm.H:
    #maxHighNYpm#",barindex[round(barNYpm/2)],maxHighNYpm+0.3*tr)
    drawtext("NYpm.L:
    #minLowNYpm#",barindex[round(barNYpm/2)],minLowNYpm-0.3*tr)
    prevLowNYpm=minLowNYpm
    prevHighNYpm=maxHighNYpm
    previdxNYpm=barindex
    barNYpm=0
    minLowNYpm=high*100
    maxHighNYpm=0
    endif
    if low crosses under prevLowNYpm then
    drawsegment(previdxNYpm,prevLowNYpm,barindex,prevLowNYpm)coloured("purple")
    prevLowNYpm=0
    elsif opentime=limitday and prevLowNYpm<>0 then
    drawsegment(previdxNYpm,prevLowNYpm,barindex,prevLowNYpm)coloured("purple")
    prevLowNYpm=0
    elsif islastbarupdate and prevLowNYpm<>0 then
    drawsegment(previdxNYpm,prevLowNYpm,barindex,prevLowNYpm)coloured("purple")
    endif
    if high crosses over prevHighNYpm then
    drawsegment(previdxNYpm,prevHighNYpm,barindex,prevHighNYpm)coloured("purple")
    prevHighNYpm=0
    elsif opentime=limitday and prevHighNYpm<>0 then
    drawsegment(previdxNYpm,prevHighNYpm,barindex,prevHighNYpm)coloured("purple")
    prevHighNYpm=0
    elsif islastbarupdate and prevHighNYpm<>0 then
    drawsegment(previdxNYpm,prevHighNYpm,barindex,prevHighNYpm)coloured("purple")
    endif
    else
    once maxHighNY=high
    once minLowNY=low
    if opentime>=openNY and opentime<=closeNY then
    barNY=barNY+1
    if high>=maxHighNY then
    maxHighNY=high
    else
    maxHighNY=maxHighNY
    endif
    if low<=minLowNY then
    minLowNY=low
    else
    minLowNY=minLowNY
    endif
    endif
    if opentime=closeNY then
    drawrectangle(barindex[barNY],minLowNY,barindex,maxHighNY)coloured("purple")fillcolor("purple",30)
    drawtext("NY.H: #maxHighNY#",barindex[round(barNY/2)],maxHighNY+0.3*tr)
    drawtext("NY.L: #minLowNY#",barindex[round(barNY/2)],minLowNY-0.3*tr)
    prevLowNY=minLowNY
    prevHighNY=maxHighNY
    previdxNY=barindex
    barNY=0
    minLowNY=high*100
    maxHighNY=0
    endif
    if low crosses under prevLowNY then
    drawsegment(previdxNY,prevLowNY,barindex,prevLowNY)coloured("purple")
    prevLowNY=0
    elsif opentime=limitday and prevLowNY<>0 then
    drawsegment(previdxNY,prevLowNY,barindex,prevLowNY)coloured("purple")
    prevLowNY=0
    elsif islastbarupdate and prevLowNY<>0 then
    drawsegment(previdxNY,prevLowNY,barindex,prevLowNY)coloured("purple")
    endif
    if high crosses over prevHighNY then
    drawsegment(previdxNY,prevHighNY,barindex,prevHighNY)coloured("purple")
    prevHighNY=0
    elsif opentime=limitday and prevHighNY<>0 then
    drawsegment(previdxNY,prevHighNY,barindex,prevHighNY)coloured("purple")
    prevHighNY=0
    elsif islastbarupdate and prevHighNY<>0 then
    drawsegment(previdxNY,prevHighNY,barindex,prevHighNY)coloured("purple")
    endif
    endif
    //----------------------------------------------//
    //-----Limit Day--------------------------------//
    //----------------------------------------------//
    if opentime=openTrueDay then
    openTD=open
    barTD=barindex
    else
    if opentime=limitday then
    drawvline(barindex)style(dottedline)
    drawsegment(barTD,openTD,barindex,openTD)style(dottedline1)
    endif
    endif
    else
    drawtext("Change timeframe to 1hr or
    less",0,0,SansSerif,bold,34)anchor(middle,xshift,yshift)
    endif
    return

    #248184 quote
    robertogozzi
    Moderator
    Master
    Voilà (je l’ai écrit depuis le début) :
    // Time Zones
    //
    DEFPARAM DrawOnLastBarOnly = true
    ONCE ASstart     = 020000
    ONCE ASend       = 090000
    ONCE LOstart     = 090000
    ONCE LOend       = 153000
    ONCE NYstart     = 153000
    ONCE NYend       = 230000
    ONCE SessionHigh = 0
    ONCE SessionLow  = 99999999
    Offset  = highest[100](range) / 4
    Asia    = OpenTime >= ASstart AND OpenTime < ASend
    London  = OpenTime >= LOstart AND OpenTime < LOend
    NY      = OpenTime >= NYstart AND OpenTime < NYend
    IF (OpenTime = ASstart) OR (OpenTime = LOstart) OR (OpenTime = NYstart) THEN
    SessionHigh = high
    SessionLow  = low
    BarStart    = BarIndex
    ELSE
    SessionHigh = max(SessionHigh,high)
    SessionLow  = min(SessionLow,low)
    ENDIF
    IF Asia THEN
    DrawSegment(BarStart,SessionHigh,BarIndex+ 1,SessionHigh) style(line,1) coloured("Blue",255)
    DrawSegment(BarStart,SessionLow,BarIndex+ 1,SessionLow)   style(line,1) coloured("Blue",255)
    DrawText("HAS:#SessionHigh# LAS:#SessionLow#",BarStart+10,SessionHigh+Offset,Dialog,standard,10) coloured("Blue",255)
    ELSIF London THEN
    DrawSegment(BarStart,SessionHigh,BarIndex+ 1,SessionHigh) style(line,1) coloured("Red",255)
    DrawSegment(BarStart,SessionLow,BarIndex+ 1,SessionLow)   style(line,1) coloured("Red",255)
    DrawText("HL:#SessionHigh# LL:#SessionLow#",BarStart+10,SessionHigh+Offset,Dialog,standard,10) coloured("Red",255)
    ELSIF NY THEN
    DrawSegment(BarStart,SessionHigh,BarIndex+ 1,SessionHigh) style(line,1) coloured("Green",255)
    DrawSegment(BarStart,SessionLow,BarIndex+ 1,SessionLow)   style(line,1) coloured("Green",255)
    DrawText("HNY:#SessionHigh# LNY:#SessionLow#",BarStart+10,SessionHigh+Offset,Dialog,standard,10) coloured("Green",255)
    ENDIF
    RETURN
    Iván González and Med5 thanked this post
    #248210 quote
    Med5
    Participant
    Junior
    Merci pour le code fourni, il fonctionne bien pour afficher la session en cours (Asia, London ou NY). Par contre, mon objectif est de voir le range High/Low de la session précédente pendant la session actuelle : Pendant London, voir le range de l’Asia, et pendant New York, voir le range de London et de Asia. le code affiche uniquement la session active, donc je ne vois plus Asia dès que London commence. Est-ce que vous pourriez l’ajuster pour garder visibles les ranges précédents de la journée ? Merci d’avance 🙏 Bonne journée
    #248244 quote
    Denis Quéva
    Participant
    New
    // Time Zones
    //
    DEFPARAM DrawOnLastBarOnly = true
    ONCE ASstart     = 020000
    ONCE ASend       = 090000
    ONCE LOstart     = 090000
    ONCE LOend       = 153000
    ONCE NYstart     = 153000
    ONCE NYend       = 230000
    
    // Range de la dernière session ASIA (soit la dernière si terminée, soit celle en cours)
    IF (OpenTime = ASstart) THEN
    ASbarStart = BarIndex
    ENDIF
    IF (Time = ASend) THEN
    ASbarEnd = BarIndex
    endif
    if ASbarEnd < ASbarStart then // Si il y a une session en cours, alors la fin est glissante
    ASlastBar = barindex
    else
    ASlastBar = ASbarEnd // Sinon la session est terminée, la fin est figée
    endif
    ASbackward = barindex - ASlastBar // Depuis combine de temps la session est-elle terminée ?
    ASperiod   = ASlastBar - ASbarStart // Durée de la session
    if ASperiod > 0 then
    ASsessionHigh = highest[ASperiod](high[ASbackward]) // Plus haut de la session
    ASsessionLow = lowest[ASperiod](low[ASbackward]) // Plus bas de la session
    else
    ASsessionHigh = high
    ASsessionLow = low
    endif
    
    // Range de la dernière session LONDON (soit la dernière si terminée, soir en cours)
    IF (OpenTime = LOstart) THEN
    LObarStart = BarIndex
    ENDIF
    IF (Time = LOend) THEN
    LObarEnd = BarIndex
    endif
    if LObarEnd < LObarStart then // Si il y a une session en cours, alors la fin est glissante
    LOlastBar = barindex
    else
    LOlastBar = LObarEnd // Sinon la session est terminée, est figée
    endif
    LObackward = barindex - LOlastBar // Depuis combine de temps la session est-elle terminée ?
    LOperiod   = LOlastBar - LObarStart // Durée de la session
    if LOperiod > 0 then
    LOsessionHigh = highest[LOperiod](high[LObackward]) // Plus haut de la session
    LOsessionLow = lowest[LOperiod](low[LObackward]) // Plus bas de la session
    else
    LOsessionHigh = high
    LOsessionLow = low
    endif
    
    // Range de la dernière session NY (soit la dernière si terminée, soir en cours)
    IF (OpenTime = NYstart) THEN
    NYbarStart = BarIndex
    ENDIF
    IF (Time = NYend) THEN
    NYbarEnd = BarIndex
    endif
    if NYbarEnd < NYbarStart then // Si il y a une session en cours, alors la fin est glissante
    NYlastBar = barindex
    else
    NYlastBar = NYbarEnd // Sinon la session est terminée, est figée
    endif
    NYbackward = barindex - NYlastBar // Depuis combine de temps la session est-elle terminée ?
    NYperiod   = NYlastBar - NYbarStart // Durée de la session
    if NYperiod > 0 then
    NYsessionHigh = highest[NYperiod](high[NYbackward]) // Plus haut de la session
    NYsessionLow = lowest[NYperiod](low[NYbackward]) // Plus bas de la session
    else
    NYsessionHigh = high
    NYsessionLow = low
    endif
    
    IF Asia THEN
    Drawvline(ASbarStart) coloured("Blue",255)
    Drawvline(ASlastBar) coloured("Blue",255)
    DrawSegment(ASbarStart,ASsessionHigh,BarIndex+ 1,ASsessionHigh) style(line,1) coloured("Blue",255) anchor(bottom,index,value)
    DrawSegment(ASbarStart,ASsessionLow,BarIndex+ 1,ASsessionLow)   style(line,1) coloured("Blue",255)
    DrawText("HAS:#ASSessionHigh# LAS:#ASSessionLow#",ASbarStart+10,-30,Dialog,standard,10) coloured("Blue",255) anchor(top,index,yshift)
    endif
    IF London THEN
    Drawvline(LObarStart) coloured("Red",255)
    Drawvline(LOlastBar) coloured("Red",255)
    DrawSegment(LOBarStart,LOSessionHigh,BarIndex+ 1,LOSessionHigh) style(line,1) coloured("Red",255)
    DrawSegment(LOBarStart,LOSessionLow,BarIndex+ 1,LOSessionLow)   style(line,1) coloured("Red",255)
    DrawText("HL:#LOSessionHigh# LL:#LOSessionLow#",LOBarStart+10,-30,Dialog,standard,10) coloured("Red",255) anchor(top,index,yshift)
    endif
    IF NY THEN
    Drawvline(NYbarStart) coloured("Green",255)
    Drawvline(NYlastBar) coloured("Green",255)
    DrawSegment(NYBarStart,NYSessionHigh,BarIndex+ 1,NYSessionHigh) style(line,1) coloured("Green",255)
    DrawSegment(NYBarStart,NYSessionLow,BarIndex+ 1,NYSessionLow)   style(line,1) coloured("Green",255)
    DrawText("HNY:#NYSessionHigh# LNY:#NYSessionLow#",NYBarStart+10, -30,Dialog,standard,10) coloured("Green",255) anchor(top,index,yshift)
    ENDIF
    
    RETURN
    
    Essaie ce code 😉 J’ai ajouté des barres verticales qui délimitent la période de chaque marché (à supprimer éventuellement). Par contre, j’ai prévu des cases à cocher (à ajouter en variables) pour afficher les marchés que tu souhaites voir apparaître.
    Med5 and robertogozzi thanked this post
    #248245 quote
    Denis Quéva
    Participant
    New
    en ligne 80 “anchor(bottom,index,value)” est inutile
    #248248 quote
    Med5
    Participant
    Junior
    Merci beaucoup, j’ai une erreur au niveau du code : Définir la variable suivante: Asia London , NY , j’ai reglé ca avec GPT , mais j ai que la session actuel de Londre qui s’affiche , je veux aussi voir la session Asie SVP
    // Time Zones (heures converties en ET)
    DEFPARAM DrawOnLastBarOnly = true
    ONCE ASstart     = 200000 // 20:00 ET (Asia Start)
    ONCE ASend       = 030000 // 03:00 ET (Asia End)
    ONCE LOstart     = 030000 // 03:00 ET (London Start)
    ONCE LOend       = 093000 // 09:30 ET (London End)
    ONCE NYstart     = 093000 // 09:30 ET (New York Start)
    ONCE NYend       = 160000 // 16:00 ET (New York End)
    
    // Définition des sessions actives
    Asia   = (OpenTime >= ASstart OR OpenTime < ASend)
    London = (OpenTime >= LOstart AND OpenTime < LOend)
    NY     = (OpenTime >= NYstart AND OpenTime < NYend)
    
    // -------------------- Session ASIA --------------------
    IF (OpenTime = ASstart) THEN
     ASbarStart = BarIndex
    ENDIF
    IF (Time = ASend) THEN
     ASbarEnd = BarIndex
    endif
    if ASbarEnd < ASbarStart then
     ASlastBar = barindex
    else
     ASlastBar = ASbarEnd
    endif
    ASbackward = barindex - ASlastBar
    ASperiod   = ASlastBar - ASbarStart
    if ASperiod > 0 then
     ASsessionHigh = highest[ASperiod](high[ASbackward])
     ASsessionLow = lowest[ASperiod](low[ASbackward])
    else
     ASsessionHigh = high
     ASsessionLow = low
    endif
    
    // -------------------- Session LONDON --------------------
    IF (OpenTime = LOstart) THEN
     LObarStart = BarIndex
    ENDIF
    IF (Time = LOend) THEN
     LObarEnd = BarIndex
    endif
    if LObarEnd < LObarStart then
     LOlastBar = barindex
    else
     LOlastBar = LObarEnd
    endif
    LObackward = barindex - LOlastBar
    LOperiod   = LOlastBar - LObarStart
    if LOperiod > 0 then
     LOsessionHigh = highest[LOperiod](high[LObackward])
     LOsessionLow = lowest[LOperiod](low[LObackward])
    else
     LOsessionHigh = high
     LOsessionLow = low
    endif
    
    // -------------------- Session NEW YORK --------------------
    IF (OpenTime = NYstart) THEN
     NYbarStart = BarIndex
    ENDIF
    IF (Time = NYend) THEN
     NYbarEnd = BarIndex
    endif
    if NYbarEnd < NYbarStart then
     NYlastBar = barindex
    else
     NYlastBar = NYbarEnd
    endif
    NYbackward = barindex - NYlastBar
    NYperiod   = NYlastBar - NYbarStart
    if NYperiod > 0 then
     NYsessionHigh = highest[NYperiod](high[NYbackward])
     NYsessionLow = lowest[NYperiod](low[NYbackward])
    else
     NYsessionHigh = high
     NYsessionLow = low
    endif
    
    // -------------------- DESSIN --------------------
    IF Asia THEN
     Drawvline(ASbarStart) coloured("Blue",255)
     Drawvline(ASlastBar) coloured("Blue",255)
     DrawSegment(ASbarStart,ASsessionHigh,BarIndex+1,ASsessionHigh) style(line,1) coloured("Blue",255)
     DrawSegment(ASbarStart,ASsessionLow,BarIndex+1,ASsessionLow)   style(line,1) coloured("Blue",255)
     DrawText("HAS:#ASsessionHigh# LAS:#ASsessionLow#",ASbarStart+10,-30,Dialog,standard,10) coloured("Blue",255) anchor(top,index,yshift)
    ENDIF
    
    IF London THEN
     Drawvline(LObarStart) coloured("Red",255)
     Drawvline(LOlastBar) coloured("Red",255)
     DrawSegment(LOBarStart,LOSessionHigh,BarIndex+1,LOSessionHigh) style(line,1) coloured("Red",255)
     DrawSegment(LOBarStart,LOSessionLow,BarIndex+1,LOSessionLow)   style(line,1) coloured("Red",255)
     DrawText("HL:#LOsessionHigh# LL:#LOsessionLow#",LOBarStart+10,-30,Dialog,standard,10) coloured("Red",255) anchor(top,index,yshift)
    ENDIF
    
    IF NY THEN
     Drawvline(NYbarStart) coloured("Green",255)
     Drawvline(NYlastBar) coloured("Green",255)
     DrawSegment(NYBarStart,NYSessionHigh,BarIndex+1,NYSessionHigh) style(line,1) coloured("Green",255)
     DrawSegment(NYBarStart,NYSessionLow,BarIndex+1,NYSessionLow)   style(line,1) coloured("Green",255)
     DrawText("HNY:#NYsessionHigh# LNY:#NYsessionLow#",NYBarStart+10,-30,Dialog,standard,10) coloured("Green",255) anchor(top,index,yshift)
    ENDIF
    
    RETURN
    
    #248249 quote
    Denis Quéva
    Participant
    New
    c’est normal  car avec ce que tu as ajouté, les marchés n’apparaissent que lorsqu’ils sont ouverts.
    // Définition des sessions actives
    Asia   = (OpenTime >= ASstart OR OpenTime < ASend)
    London = (OpenTime >= LOstart AND OpenTime < LOend)
    NY     = (OpenTime >= NYstart AND OpenTime < NYend)
    Or comme je précisais dans ma réponde il faut créer les variables en paramètres utilisateur.
    Med5 thanked this post
    #248251 quote
    Denis Quéva
    Participant
    New
    c’est très simple, ouvre le code et clique sur la clé à côté de “Variables” en haut à gauche. Puis tu ajoutes ceci
    Med5 thanked this post
    #248253 quote
    Med5
    Participant
    Junior
    d’accord mais quand j’ajoute ton code tel qu’il est j’ai cette erreur la : Définir la variable suivante: Asia London , NY, merci,
    #248256 quote
    Med5
    Participant
    Junior
    Désolé je viens de comprendre le soucis , merci beacoup
    #248257 quote
    Denis Quéva
    Participant
    New
    Voir mon dernier message.
    Med5 thanked this post
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.

Modification de code pour optimisation visuelle


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Med5 @adilmed10 Participant
Summary

This topic contains 10 replies,
has 3 voices, and was last updated by Denis Quéva
7 months, 3 weeks ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 06/11/2025
Status: Active
Attachments: 4 files
Logo Logo
Loading...