//+-----+ //|DIBS | //+-----+ #property copyright "Ron Thompson" #property link "http://www.ForexMT4.com/" // This INDICATOR is NEVER TO BE SOLD individually // This INDICATOR is NEVER TO BE INCLUDED as part of a collection that is SOLD // Bar handling datetime bartime=0; // used to determine when a bar has moved // Objects int uniq=0; //Point double myPoint; #property indicator_chart_window #property indicator_buffers 8 #property indicator_color1 White #property indicator_width1 3 #property indicator_color2 Red #property indicator_width2 3 #property indicator_color3 MediumSeaGreen #property indicator_width3 1 #property indicator_color4 MediumSeaGreen #property indicator_width4 1 #property indicator_color5 MediumSeaGreen #property indicator_width5 1 #property indicator_color6 White #property indicator_width6 3 #property indicator_color7 LimeGreen #property indicator_width7 3 #property indicator_color8 Red #property indicator_width8 3 //---- buffers int mybars=10000; double i0[]; double i1[]; double i2[]; double i3[]; double i4[]; double i5[]; double i6[]; double i7[]; //+----------------+ //| Custom init | //+----------------+ int init() { // 233 up arrow // 234 down arrow // 159 big dot // 158 little dot // 168 open square // 120 box with X IndicatorBuffers(8); SetIndexStyle(0,DRAW_ARROW); //i0 SetIndexArrow(0,120); SetIndexBuffer(0,i0); SetIndexStyle(1,DRAW_ARROW); //i1 SetIndexArrow(1,120); SetIndexBuffer(1,i1); SetIndexStyle(2,DRAW_LINE); //i2 //SetIndexArrow(2,158); SetIndexBuffer(2,i2); SetIndexStyle(3,DRAW_LINE); //i3 //SetIndexArrow(3,158); SetIndexBuffer(3,i3); SetIndexStyle(4,DRAW_LINE); //i4 //SetIndexArrow(4,168); SetIndexBuffer(4,i4); SetIndexStyle(5,DRAW_ARROW); //i5 SetIndexArrow(5,168); SetIndexBuffer(5,i5); SetIndexStyle(6,DRAW_ARROW); //i6 SetIndexArrow(6,168); SetIndexBuffer(6,i6); SetIndexStyle(7,DRAW_ARROW); //i7 SetIndexArrow(7,168); SetIndexBuffer(7,i7); ObjectsDeleteAll(); myPoint = SetPoint(); } //+----------------+ //| Custom DE-init | //+----------------+ int deinit() { ObjectsDeleteAll(); Print("DE-Init happened ",CurTime()); Comment(" "); } //+------+ //| Main | //+------+ int start() { int i; double h; double l; datetime t; if(bartime==iTime(Symbol(), 0, 0) ) return(0); bartime=iTime(Symbol(), 0, 0) ; for (i=Bars; i>=0; i--) { t=iTime(Symbol(),0,i); h=iHigh(Symbol(),0,i); l=iLow(Symbol(),0,i); if( TimeHour(t)==6 ) DrawOpen( t, iTime(Symbol(),0,i-10), iOpen(Symbol(),0,i), iOpen(Symbol(),0,i), Aqua, STYLE_SOLID ); if( iHigh(Symbol(),0,i+1) > h && iLow(Symbol(),0,i+1) < l && TimeHour(t)>=6 && TimeHour(t)<=15 ) { DrawHi( t, iTime(Symbol(),0,i-3), h, h, White, STYLE_SOLID ); DrawLo( t, iTime(Symbol(),0,i-3), l, l, Red, STYLE_SOLID ); DrawRisk( t, l+((h-l)/2), (h-l)/myPoint ) ; } }//for }//start void DrawHi(datetime x1, datetime x2, double y1, double y2, color lineColor, double style) { string labelh = "DIBSH" + DoubleToStr(x1, 0); ObjectDelete(labelh); ObjectCreate(labelh, OBJ_TREND, 0, x1, y1, x2, y2, 0, 0); ObjectSet(labelh, OBJPROP_RAY, 0); ObjectSet(labelh, OBJPROP_COLOR, lineColor); ObjectSet(labelh, OBJPROP_STYLE, style); ObjectSet(labelh, OBJPROP_WIDTH, 3); } //+------------------------------------------------------------------+ void DrawLo(datetime x1, datetime x2, double y1, double y2, color lineColor, double style) { string labell = "DIBSL" + DoubleToStr(x1, 0); ObjectDelete(labell); ObjectCreate(labell, OBJ_TREND, 0, x1, y1, x2, y2, 0, 0); ObjectSet(labell, OBJPROP_RAY, 0); ObjectSet(labell, OBJPROP_COLOR, lineColor); ObjectSet(labell, OBJPROP_STYLE, style); ObjectSet(labell, OBJPROP_WIDTH, 3); } //+------------------------------------------------------------------+ void DrawOpen(datetime x1, datetime x2, double y1, double y2, color lineColor, double style) { string labelo = "DIBSO" + DoubleToStr(x1, 0); ObjectDelete(labelo); ObjectCreate(labelo, OBJ_TREND, 0, x1, y1, x2, y2, 0, 0); ObjectSet(labelo, OBJPROP_RAY, 0); ObjectSet(labelo, OBJPROP_COLOR, lineColor); ObjectSet(labelo, OBJPROP_STYLE, style); ObjectSet(labelo, OBJPROP_WIDTH, 3); } //+------------------------------------------------------------------+ void DrawRisk( datetime x1, double y1, double risk ) { string labelr = "DIBSR" + DoubleToStr(x1, 0); ObjectCreate (labelr, OBJ_TEXT, 0, x1, y1 ); ObjectSetText(labelr, DoubleToStr(risk, 0),16,"Arial",Aqua); } //+------------------------------------------------------------------+ double SetPoint() { double mPoint; if (Digits < 4) mPoint = 0.01; else mPoint = 0.0001; return(mPoint); } /* //st00p1d sunday bar if( TimeDayOfWeek(iTime(Symbol(),0,i)) > 0 ) { if(Open[i]==High[i]) { i0[i]=Open[i]; } if(Open[i]==Low[i] ) { i1[i]=Open[i]; } if(High[i]-Open[i]<=0.00050000) { i6[i]=Open[i]; } if(Open[i]-Low[i]<=0.00050000 ) { i7[i]=Open[i]; } }//dayofweek */