//+------------------------------------------------------------------+ //| WRB-Hidden-Gap.mq5 | //| Copyright © 2014, EarnForex.com | //| http://www.earnforex.com/ | //+------------------------------------------------------------------+ #property copyright "EarnForex.com" #property link "" #property version "1.01" //--- #property description "" #property description "" #property description "" #property description "by Andriy Moraru." //--- #property indicator_chart_window //--- #property indicator_plots 1 #property indicator_buffers 1 //--- #property indicator_type1 DRAW_ARROW #property indicator_style1 STYLE_SOLID #property indicator_color1 clrAqua // WRB symbol #property indicator_width1 1 //--- #define UNFILLED_PREFIX "HG_UNFILLED_" #define FILLED_PREFIX "HG_FILLED_" #define PREFIX "HG_" //--- input bool UseWholeBars=false; input int WRB_LookBackBarCount= 3; input int WRB_WingDingsSymbol = 115; input color HGcolor1 = clrDodgerBlue; input color HGcolor2 = clrBlue; input ENUM_LINE_STYLE HGstyle=STYLE_SOLID; input int StartCalculationFromBar=100; input bool HollowBoxes=false; input bool DoAlerts=false; //---- buffers double WRB[]; //--- int totalBarCount=-1; //+------------------------------------------------------------------+ //| Delete all objects with given prefix | //+------------------------------------------------------------------+ void ObDeleteObjectsByPrefix(string Prefix) { int L = StringLen(Prefix); int i = 0; while(i H2) || (H1 < L2)) return (0); if((H1 >= H2) && (L1 >= L2)) return(1); if((H1 <= H2) && (L1 <= L2)) return(2); if((H1 >= H2) && (L1 <= L2)) return(3); if((H1 <= H2) && (L1 >= L2)) return(4); return(0); } //+------------------------------------------------------------------+ //| checkHGFilled: Check if the hidden gap is filled or not | //+------------------------------------------------------------------+ void checkHGFilled(int barNumber,const double &High[],const double &Low[],const datetime &Time[],int rates_total) { int j,i; string ObjectText; string Prefix=UNFILLED_PREFIX; double box_H,box_L; double HGFillPA_H,HGFillPA_L; datetime startTime; color objectColor; //--- int L=StringLen(Prefix); i=0; while(i=0) && (startTime HGFillPA_H) HGFillPA_H = High[barNumber - j]; if(Low[barNumber - j] < HGFillPA_L) HGFillPA_L = Low[barNumber - j]; if((HGFillPA_H>box_H) && (HGFillPA_Lbody) { WRB_test=false; break; } } //--- if(WRB_test) WRB[i]=(Open[i]+Close[i])/2; else WRB[i]=EMPTY_VALUE; //--- return(WRB_test); } //+------------------------------------------------------------------+ //| checkHG: Checks HG status of the previous bar. | //+------------------------------------------------------------------+ void checkHG(int i,const double &High[],const double &Low[],const double &Open[],const double &Close[],const datetime &Time[]) { string ObjectText; double H,L,H2,L2,H1,L1,A,B; int j; color HGcolor=HGcolor1; //--- HG-TEST ( test the previous bar i-1) if(WRB[i-1]!=EMPTY_VALUE) // First rule to become a HG is to become a WRB { H2 = High[i - 2]; L2 = Low[i - 2]; H1 = High[i]; L1 = Low[i]; //--- if(UseWholeBars) { H = High[i - 1]; L = Low[i - 1]; } else if(Open[i-1]>Close[i-1]) { H = Open[i - 1]; L = Close[i - 1]; } else { H = Close[i - 1]; L = Open[i - 1]; } //--- Older bar higher than the newer. if(L2>H1) { A = MathMin(L2, H); B = MathMax(H1, L); } else if(L1>H2) { A = MathMin(L1, H); B = MathMax(H2, L); } else return; //--- if(A>B) { int Length=StringLen(UNFILLED_PREFIX); j=0; while(j