#property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 Lime #property indicator_color3 Lime //---- input parameters static int HL_Hours = 24; //4 = 4 hours extern int distancefromopen=30; //---- indicator buffers double openbuffer[]; double topbuffer[]; double bottombuffer[]; int init() { SetIndexBuffer(0, openbuffer); SetIndexStyle(0, DRAW_LINE, 0,3); SetIndexStyle(1,DRAW_LINE,STYLE_SOLID, 2); SetIndexArrow(1,233); SetIndexBuffer(1,topbuffer); SetIndexEmptyValue(1,0.0); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID, 2); SetIndexArrow(2,234); SetIndexBuffer(2,bottombuffer); SetIndexEmptyValue(2,0.0); return(0); } int deinit() { ObjectsDeleteAll(0,OBJ_LABEL); return(0); } int start() { int count, cur_hour, prev_hour = 0; double hour_high, hour_low, H, L,O, A = 0; if (Period() >= PERIOD_D1) return(0); for (count=Bars;count>=0;count--) { topbuffer[count]=0; bottombuffer[count]=0; cur_hour = TimeHour(Time[count]); if (prev_hour != cur_hour) { prev_hour = cur_hour; if (!MathMod(cur_hour,HL_Hours)) { H = hour_high; A = (hour_high+hour_low)*0.5; L = hour_low; O=Open[count]; hour_high = High[count]; hour_low = Low[count]; } } hour_high = MathMax(hour_high, High[count]); hour_low = MathMin(hour_low, Low[count]); openbuffer[count]=O; topbuffer[count]=O+distancefromopen*Point; bottombuffer[count]=O-distancefromopen*Point; } return(0); }