//+------------------------------------------------------------------+
//|                                            FXPT_CandleSizev1.mq4 |
//|                                         Developed by fxprotrader |
//|                                     http://www.fxpro-trader.com" |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2013, fxprotrader"
#property link      "http://www.fxpro-trader.com"
//-------- HISTORY----------------
// v0.1 Initial release(01102013)
//--------------------------------

#property indicator_chart_window

extern int textPosition=4;
extern int TextAngle   =0;//0-90

double Poin;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   if (Point==0.00001) Poin=0.0001;
   else {
      if (Point==0.001) Poin=0.01;
      else Poin=Point;
   }

//----
   return(0);
  }
//+------------------------------------------------------------------+
//                                                                   +
//+------------------------------------------------------------------+
int deinit(){
   DeleteObjects();
   return(0);
}
//+------------------------------------------------------------------+
//                                                                   +
//+------------------------------------------------------------------+
void DeleteObjects(){
   int objs = ObjectsTotal();
   string name;
   for(int cnt=ObjectsTotal()-1;cnt>=0;cnt--)
   {
      name=ObjectName(cnt);
      if (StringFind(name,"FXPTc_",0)>-1) ObjectDelete(name);
      WindowRedraw();
   }
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start(){
    int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   string text,sObjName;
   double Rng;
   
   for(int i=1; i<limit; i++){
    Rng= MathAbs(High[i] - Low[i])/Poin;

text=DoubleToStr(Rng,0);//+" H:"+High[i];

if(Open[i] < Close[i]){
sObjName="FXPTc_label1"+i;
 ObjectCreate(sObjName, OBJ_TEXT, 0, Time[i], High[i]+textPosition*Poin);
  ObjectSet(sObjName, OBJPROP_ANGLE, TextAngle);
ObjectSetText(sObjName,text,10, "Corbel", Black);
}
else{
sObjName="FXPTc_label1"+i;
 ObjectCreate(sObjName, OBJ_TEXT, 0, Time[i], Low[i]-textPosition*Poin);
  ObjectSet(sObjName, OBJPROP_ANGLE, TextAngle);
ObjectSetText(sObjName,text,10, "Corbel", Black);

}
   
   
   }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+