openAS=080000
closeAS=103000
//TIMEFRAME(DEFAULT)
if gettimeframe<=3600 then
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
Once MyDate1 = openAS
Once MyDate2 = closeAs
Once Count = 0
If OpenTime >= MyDate1 AND OpenTime <= MyDate2 then
Count = Count + 1
drawtext("count: #count#",barindex[round(barAS/2)],minLowAS-1.9*tr)coloured("red")
barras=barAS-1
drawtext("#barras#",barindex[round(barAS/2)],minLowAS-1*tr)
drawrectangle(barindex[barAS],minLowAS,barindex,maxHighAS)coloured("red")fillcolor("red",30)
drawtext("High: #maxHighAS#",barindex[round(barAS/2)],maxHighAS-0.3*tr)coloured("red")
drawtext("Low: #minLowAS#",barindex[round(barAS/2)],minLowAS+0.3*tr)coloured("red")
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("red")
prevLowAS=0
elsif islastbarupdate and prevLowAS<>0 then
drawsegment(previdxAS,prevLowAS,barindex,prevLowAS)coloured("red")
endif
if high crosses over prevHighAS then
drawsegment(previdxAS,prevHighAS,barindex,prevHighAS)coloured("red")
prevHighAS=0
elsif islastbarupdate and prevHighAS<>0 then
drawsegment(previdxAS,prevHighAS,barindex,prevHighAS)coloured("red")
endif
endif
endif
return