Top !

Code : #
defparam calculateonlastbars = 500 // à commenter pour avoir historique
Defparam DrawOnLastBarOnly = true // à commenter pour avoir historique
setclosehour = 220000
setopenhour = 153000
setoffset = 10
//vertical offset to draw text corectly over horizontal LINE
voffset = setoffset* pipsize
//Calculation min and max full day (between SetOpenHour and SetCloseHour)
//reset values each days
If IntraDayBarIndex = 0 then
HighestH = 0
LowestL = 99999
endif
//loop to test highest and lowest at each candle during open hours
if time > SetOpenHour and time <= SetCloseHour then
HighestH = max(high,HighestH)
LowestL = min(low,LowestL)
endif
//to keep the highest and lowest of the open hours
IF time = SetCloseHour THEN
lasthighestH = HighestH
lastlowestL = LowestL
ENDIF
//when new day start (same open hours), live highest and lowest
if time > SetOpenHour and time <= SetCloseHour then
actualdayhighest = max(high,HighestH)
actualdaylowest = min(low,LowestL)
endif
//actual high and low
Actualhigh = High
Actuallow = Low
//variation max-min for the day before
varDayBefore = lasthighestH - lastlowestL
//lines calculation and drawing
Line50 = actualDaylowest + varDayBefore/2
Diffline50 = Line50 - Actualhigh //difference actual high and line price
DRAWRAY(barindex-10, Line50 , Line50 , Line50 ) coloured(0,255,255) STYLE(line,1)
DRAWTEXT("#Diffline50# Line50 #Line50#", barindex-5, Line50+voffset ) coloured(0,255,255)
LinePos1 = actualDaylowest + varDayBefore + 8
Difflinepos1 = LinePos1 - Actualhigh //difference actual high and line price
DRAWRAY(barindex-10, LinePos1 , LinePos1 , LinePos1 ) coloured(0,255,255) STYLE(line,1)
DRAWTEXT("#Difflinepos1# Line+1 #LinePos1#", barindex-5, LinePos1+voffset ) coloured(0,255,255)
LinePos2 = actualDaylowest + varDayBefore + varDayBefore/2 + 8
Difflinepos2 = LinePos2 - Actualhigh //difference actual high and line price
DRAWRAY(barindex-10, LinePos2 , LinePos2 , LinePos2 ) coloured(0,255,255) STYLE(DOTTEDLINE,1)
DRAWTEXT("#Difflinepos2# Line+2 #LinePos2#", barindex-5, LinePos2+voffset ) coloured(0,255,255)
LineNeg1 = actualdayhighest - varDayBefore - 8
Difflineneg1 = LineNeg1 - Actuallow //difference actual low and line price
DRAWRAY(barindex-10, Lineneg1 , LineNeg1 , LineNeg1 ) coloured(0,255,255) STYLE(line,1)
DRAWTEXT("#Difflineneg1# Line-1 #LineNeg1#", barindex-5, LineNeg1+voffset ) coloured(0,255,255)
LineNeg2 = actualdayhighest - varDayBefore - varDayBefore/2 - 8
Difflineneg2 = LineNeg2 - Actuallow //difference actual low and line price
DRAWRAY(barindex-10, Lineneg2 , LineNeg2 , LineNeg2 ) coloured(0,255,255) STYLE(DOTTEDLINE ,1)
DRAWTEXT("#Difflineneg2# Line-2 #LineNeg2#", barindex-5, LineNeg2+voffset ) coloured(0,255,255)
//pour avoir l'historique enlever les commentaire après "return" et commenter les deparam du haut
return //Line50 , LinePos1 , LinePos2 , LineNeg1 , LineNeg2