This indicator is a further adaptation of my DOWAR – Day Of Week Average Range Bands indicator that can be found here:
https://www.prorealcode.com/prorealtime-indicators/dowar-day-of-week-average-range-bands/
This version calculates an all time average range for each hour of the day and then applies it to the chart as bands or a background candle or both. So for example on candles that open at 1000 and close at 1100 the bands (or background candle) will represent the all time average range for all recorded hours of 1000 to 1100 up to that date.
The bands/candles can be made wider or narrower by adjusting the ‘Multiple’ setting.
The centre of the bands/candles can be based on any custom close such as median price, close, typical price, total price etc.
By adjusting the offset you can decide which hours custom close the bands/candles will be centred on. Zero = this hour’s, 1 = the previous hour’s etc.
You can set the start date from when the indicator should start calculating the hourly averages. Set StartDate to zero if you want to use all available history.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
//HODAR Bands - Hour Of Day Average Range Bands //By Vonasi //20181219 //Multiple = 1 //Offset = 1 //Bands = 0 //Candles = 1 //StartDate = 0 if opendate >= StartDate or startdate = 0 then IF openhour = 0 THEN H0 = (H0 + (High - Low)) H0Count = (H0Count + 1) ThisHour = (H0 / H0Count) ELSIF openhour = 1 THEN H1 = (H1 + (High - Low)) H1Count = (H1Count + 1) ThisHour = (H1 / H1Count) ELSIF openhour = 2 THEN H2 = (H2 + (High - Low)) H2Count = (H2Count + 1) ThisHour = (H2 / H2Count) ELSIF openhour = 3 THEN H3 = (H3 + (High - Low)) H3Count = (H3Count + 1) ThisHour = (H3 / H3Count) ELSIF openhour = 4 THEN H4 = (H4 + (High - Low)) H4Count = (H4Count + 1) ThisHour = (H4 / H4Count) ELSIF openhour = 5 THEN H5 = (H5 + (High - Low)) H5Count = (H5Count + 1) ThisHour = (H5 / H5Count) ELSIF openhour = 6 THEN H6 = (H6 + (High - Low)) H6Count = (H6Count + 1) ThisHour = (H6 / H6Count) ELSIF openhour = 7 THEN H7 = (H7 + (High - Low)) H7Count = (H7Count + 1) ThisHour = (H7 / H7Count) ELSIF openhour = 8 THEN H8 = (H8 + (High - Low)) H8Count = (H8Count + 1) ThisHour = (H8 / H8Count) ELSIF openhour = 9 THEN H9 = (H9 + (High - Low)) H9Count = (H9Count + 1) ThisHour = (H9 / H9Count) ELSIF openhour = 10 THEN H10 = (H10 + (High - Low)) H10Count = (H10Count + 1) ThisHour = (H10 / H10Count) ELSIF openhour = 11 THEN H11 = (H11 + (High - Low)) H11Count = (H11Count + 1) ThisHour = (H11 / H11Count) ELSIF openhour = 12 THEN H12 = (H12 + (High - Low)) H12Count = (H12Count + 1) ThisHour = (H12 / H12Count) ELSIF openhour = 13 THEN H13 = (H13 + (High - Low)) H13Count = (H13Count + 1) ThisHour = (H13 / H13Count) ELSIF openhour = 14 THEN H14 = (H14 + (High - Low)) H14Count = (H14Count + 1) ThisHour = (H14 / H14Count) ELSIF openhour = 15 THEN H15 = (H15 + (High - Low)) H15Count = (H15Count + 1) ThisHour = (H15 / H15Count) ELSIF openhour = 16 THEN H16 = (H16 + (High - Low)) H16Count = (H16Count + 1) ThisHour = (H16 / H16Count) ELSIF openhour = 17 THEN H17 = (H17 + (High - Low)) H17Count = (H17Count + 1) ThisHour = (H17 / H17Count) ELSIF openhour = 18 THEN H18 = (H18 + (High - Low)) H18Count = (H18Count + 1) ThisHour = (H18 / H18Count) ELSIF openhour = 19 THEN H19 = (H19 + (High - Low)) H19Count = (H19Count + 1) ThisHour = (H19 / H19Count) ELSIF openhour = 20 THEN H20 = (H20 + (High - Low)) H20Count = (H20Count + 1) ThisHour = (H20 / H20Count) ELSIF openhour = 21 THEN H21 = (H21 + (High - Low)) H21Count = (H21Count + 1) ThisHour = (H21 / H21Count) ELSIF openhour = 22 THEN H22 = (H22 + (High - Low)) H22Count = (H22Count + 1) ThisHour = (H22 / H22Count) ELSIF openhour = 23 THEN H23 = (H23 + (High - Low)) H23Count = (H23Count + 1) ThisHour = (H23 / H23Count) ENDIF upper = customclose[offset] + ((ThisHour * multiple)/2) lower = customclose[offset] - ((ThisHour * multiple)/2) if candles then drawcandle(lower,upper,lower,upper) COLOURED(100,149,237,20) BORDERCOLOR(0,0,0,100) endif c = 0 if bands then c = 255 endif else upper = close lower = close c = 0 endif RETURN upper coloured (100,149,237,c) style(line, 1) as "Upper Band", lower coloured (100,149,237,c) style(line, 1) as "Lower Band" |
Apply the indicator only to the hourly price chart.
I recommend that you download the itf file and import it to get full functionality rather than cut and pasting the code.
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials