#property  copyright ""
#property  indicator_chart_window
#property  indicator_buffers 1
int limit;
int init ()
  {
//NOTE: this simple indicator notates the Doji type bars on a chart. If you change time frames it will leave the Doji name so they
//must be deleted from the objects list when changing time frames
   return(0);
  }
int deinit()
  {
   return(0);
  }
int start()
	{
   double O,C,H,L;
   string text;
   int counted_bars=IndicatorCounted();
   limit=Bars-counted_bars;
   //---- check for possible errors
   if(counted_bars<0) {
	  Alert("No Bars..");
	  return(-1);
   }
   //---- last counted bar will be recounted
   for(int i=1; i<limit; i++) {
	  O=iOpen(NULL,0,i);
	  C=iClose(NULL,0,i);
	  H=iHigh(NULL,0,i);
	  L=iLow(NULL,0,i);
	  
	  text="";	 
	  
//The next line allows you to set the Doji open/close spacing and height. For example: MathAbs(C-O)<0.03 finds candles with less than 3 pips
//absolute difference from the open to the close and MathAbs(H-L)>0.25 requires the candle to be greater than 25 pips tall. These values can be
//changed to find the type of candle you are looking for. To find candles of any height without concern for Doji status you can set the C-O<1000
//and H-L>100 to find only candles with at least 100 pip height;
	  if(((MathAbs(C-O)<0.03))&&(MathAbs(H-L)>0.25)) text="Doji";
	  if(text!="")
	  {
	  ObjectCreate(DoubleToStr(i,0)+" label", OBJ_TEXT, 0, Time[i], H);
	  ObjectSetText(DoubleToStr(i,0)+" label", text, 16, "Arial", Blue);
	  }
	}
}