I’m trying to place an arrow over today’s highest and lowest bar of the day on a 1 hour chart (this will be applied to UK shares which have 9 bars a day between 8:00 & 16:30). If multiple bars match the High/Low of the day I would only like to highlight the first bar that matches.
I have limited experience with ProBuilder, so I decided to start by building an indicator that just highlights the bar that contains the high of the day. When I had that working I was going to add the low bar of the day and then limit it to highlighting only the first matching High/Low using the once command.
Unfortunately I’m having difficulty matching only the high of the day. No matter what I try, bars that don’t match the high of the day are being highlighted.
The first thing I tried was this.
if OpenDate = today and high = dhigh(0) then
DRAWARROWDOWN(barindex, high)
endif
return
I thought that this would work, but it was highlighting bars that didn’t match the day’s high, as shown in the attachment.
What seems to be happening is that when you use DHigh on a 1 hour chart it doesn’t give the high of the whole day, but instead gives the highest price reached so far in the day for each bar.
I.e. for the third bar of the day, DHigh only returns the highest price reached during the first three bars of the day, even though there is data available for the whole day. (WholeDayHigh would be a really useful constant to have)
After searching the forum for ideas, these are some of the things that I have tried.
All of them have the same problem of highlighting bars that don’t match the high of the day.
IF OpenDate = today and high = highest[9](high) then
DRAWARROWDOWN(barindex, high)
endif
return
This is also problematic because it looks back 9 bars and sometimes the IG data is missing bars. If there are one or more bars missing, looking back 9 bars would include some of the previous days data.
I also tried this.
Newhighest=0
FOR a = 0 TO 9 DO
IF OpenDate = today and DHigh(a)>Newhighest THEN
Newhighest = DHigh(a)
ENDIF
NEXT
if high = Newhighest then
DRAWARROWDOWN(barindex, high)
endif
return
and this.
WholeDayHigh = 0
i = 0
bars = 9
WHILE OpenDate[i] = today and i < bars DO IF High[i]>WholeDayHigh THEN
WholeDayHigh = High[i]
ENDIF
i = i + 1
WEND
if high = WholeDayHigh then
DRAWARROWDOWN(barindex, high)
endif
return
Which all gave the same result.
Any help solving this would be much appreciated.