Hi all! Stupid Oclock in the morning where I am. Well it is to me anyway, I should be in my bed. I’m trying to code a high and low rectangle of certain daily time periods on any timeframe. I can manage one time period but I’m trying to show multiple times and it’s not working out for me. It’s a piece of code I found here and I’m trying to adapt it to show multiple times…here is what I have worked up to…
if intradaybarindex=0 then
maxvalue=0
minvalue=Dclose(0)*5
MyBar=0
endif
timerange = time>=020000 and time<=050000
if timerange then
maxvalue = max(maxvalue , high)
minvalue = min(minvalue , low)
if MyBar=0 then
x1=barindex
MyBar=1
endif
if time=050000 then
x2=barindex
DRAWRECTANGLE(x1,maxvalue,x2,minvalue) coloured(06,17,79)
endif
maxvalue=0
minvalue=Dclose(0)*5
MyBar=0
endif
timerange = time>=070000 and time<=100000
if timerange then
maxvalue = max(maxvalue , high)
minvalue = min(minvalue , low)
if MyBar=0 then
x1=barindex
MyBar=1
endif
if time=100000 then
x2=barindex
DRAWRECTANGLE(x1,maxvalue,x2,minvalue) coloured(06,17,79)
endif
endif
RETURN
Would someone be so kind to show me where I’m going wrong?
Thank you!
Try moving line 35 to in between lines 30 and 31.
Try moving line 35 to in between lines 30 and 31.
Thank you very much. I tried it but it didn’t workout. However a workaround I achieved was to create separate timeframe codes for the individual times I’m looking for. This works for me because I can toggle them individually. Thanks for your reply, much appreciated sir! Mission was still accomplished. 🙂