Hi, I’m rubbish at coding. Please help with indicator?
- Vertical line at Monday at 12am, signaling start of new week, accessible on all time frames.
- Current week high and week low horizontal lines. Preferably accessible on all time frames, otherwise specific to 15 minutes and 1 hour.
Thanks.
This indicator will do your second request.
Yearly Quarterly Monthly Weekly Daily H4 H1 OHLC Lines – Last Bar Only Version
EDIT: I just reread your question. This indicator actually does the last closed weeks levels are you wanting the current still forming weeks high and low?
This should do your first request:
if opentime = 120000 and opendayofweek = 1 then
drawvline(barindex)
endif
Shouldn’t 12am be written as 000000?
12pm is 120000.
This should do what you want:
if opentime = 000000 and opendayofweek = 1 then
drawvline(barindex)
endif
if opendayofweek < opendayofweek[1] then
hh=high
ll=low
endif
hh = max(hh,high)
ll = min(ll,low)
return hh as "This weeks high", ll as "This weeks low"
Shouldn’t 12am be written as 000000?
12pm is 120000.
Well spotted Roberto – I really shouldn’t scan read questions in a hurry to get to my cheese and tomato sandwich!
Hi Guys, thanks for your assistance.
Is it perhaps possible to draw segment of highs and lows for this week only, disregarding previous weeks?
That’s a bit tricky because we can’t delete drawn objects so the only way we can do that is to wait till the end of the week and then draw it which is not going to be any use during the week!
It would be possible to just have it as two horizontal lines that move up and down though.
In v11 it might be possible to create something using arrays that could do it but it would be quite a lot of work.