Bonjour,
voilà ci-dessous le code ICT KILLZONES.Seul ASIE-LONDRES-NYam sont utilisés.
Je cherche à tracer la middle de ces rectangles (en sachant qu’ils ne sont dessinés qu’à la fin du temps de la zone).L’idéal serait que la moyenne se trace au fur et à mesure du timeframe puis s’arrête quand le rectangle se trace ou bien même s’arrête lorsque la nouvelle zone arrive.Puis retrace la nouvelle moyenne de la nouvelle zone (europe) et ainsi de suite jusqu’à la zone NYam.
//----------------------------------------------//
//PRC_ICT Killzones and Pivots
//version = 0
//10.10.2024
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//----------------------------------------------//
//-----INPUTS-----------------------------------//
//----------------------------------------------//
//OpenASIE=000000
//CloseASIE=060000
//OpenLONDRES=080000
//CloseLONDRES=140000
//openNYam=153000
//closeNYam=220000
//openNYlch=000000
//closeNYlch=000000
//openNYpm=000000
//closeNYpm=000000
openNY=openNYam
closeNY=closeNYpm
limitday=220000
openTrueDay=010000
if gettimeframe<=3600 then
//----------------------------------------------//
//-----ASIA Zone--------------------------------//
//----------------------------------------------//
once maxHighAS=high
once minLowAS=low
if opentime>=OpenASIE and opentime<=CloseASIE 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=CloseASIE then
drawrectangle(barindex[barAS],minLowAS,barindex,maxHighAS)coloured("SPRINGGREEN")fillcolor("SPRINGGREEN",250)
drawtext("ASIE H: #maxHighAS#",barindex[round(barAS/2)],maxHighAS+0.3*tr)
drawtext("ASIE 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("SPRINGGREEN")style(line,4)
prevLowAS=0
elsif opentime=limitday and prevLowAS<>0 then
drawsegment(previdxAS,prevLowAS,barindex,prevLowAS)coloured("SPRINGGREEN")style(line,4)
prevLowAS=0
elsif islastbarupdate and prevLowAS<>0 then
drawsegment(previdxAS,prevLowAS,barindex,prevLowAS)coloured("SPRINGGREEN")style(line,4)
endif
if high crosses over prevHighAS then
drawsegment(previdxAS,prevHighAS,barindex,prevHighAS)coloured("SPRINGGREEN")style(line,4)
prevHighAS=0
elsif opentime=limitday and prevHighAS<>0 then
drawsegment(previdxAS,prevHighAS,barindex,prevHighAS)coloured("SPRINGGREEN")style(line,4)
prevHighAS=0
elsif islastbarupdate and prevHighAS<>0 then
drawsegment(previdxAS,prevHighAS,barindex,prevHighAS)coloured("SPRINGGREEN")style(line,4)
endif
//----------------------------------------------//
//-----London Zone------------------------------//
//----------------------------------------------//
once maxHighLO=high
once minLowLO=low
if opentime>=OpenLONDRES and opentime<=CloseLONDRES 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=CloseLONDRES then
drawrectangle(barindex[barLO],minLowLO,barindex,maxHighLO)coloured("ORANGE")fillcolor("orange",200)
drawtext("LONDRES H: #maxHighLO#",barindex[round(barLO/2)],maxHighLO+0.3*tr)
drawtext("LONDRES 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("orange")
prevLowLO=0
elsif opentime=limitday and prevLowLO<>0 then
drawsegment(previdxLO,prevLowLO,barindex,prevLowLO)coloured("orange")
prevLowLO=0
elsif islastbarupdate and prevLowLO<>0 then
drawsegment(previdxLO,prevLowLO,barindex,prevLowLO)coloured("orange")
endif
if high crosses over prevHighLO then
drawsegment(previdxLO,prevHighLO,barindex,prevHighLO)coloured("orange")
prevHighLO=0
elsif opentime=limitday and prevHighLO<>0 then
drawsegment(previdxLO,prevHighLO,barindex,prevHighLO)coloured("orange")
prevHighLO=0
elsif islastbarupdate and prevHighLO<>0 then
drawsegment(previdxLO,prevHighLO,barindex,prevHighLO)coloured("orange")
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("cadetblue")fillcolor("cadetblue",200)
drawtext("US H: #maxHighNYam#",barindex[round(barNYam/2)],maxHighNYam+0.3*tr)
drawtext("US 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("cadetblue")
prevLowNYam=0
elsif opentime=limitday and prevLowNYam<>0 then
drawsegment(previdxNYam,prevLowNYam,barindex,prevLowNYam)coloured("cadetblue")
prevLowNYam=0
elsif islastbarupdate and prevLowNYam<>0 then
drawsegment(previdxNYam,prevLowNYam,barindex,prevLowNYam)coloured("cadetblue")
endif
if high crosses over prevHighNYam then
drawsegment(previdxNYam,prevHighNYam,barindex,prevHighNYam)coloured("cadetblue")
prevHighNYam=0
elsif opentime=limitday and prevHighNYam<>0 then
drawsegment(previdxNYam,prevHighNYam,barindex,prevHighNYam)coloured("cadetblue")
prevHighNYam=0
elsif islastbarupdate and prevHighNYam<>0 then
drawsegment(previdxNYam,prevHighNYam,barindex,prevHighNYam)coloured("cadetblue")
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",150)
drawtext("CLOTURE H: #maxHighNYpm#",barindex[round(barNYpm/2)],maxHighNYpm+0.3*tr)
drawtext("CLOTURE 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",150)
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
merci à vous je joins un graphe