Navigation:Home > Content >

Candle_size.mq4

Time: 2013-02-13 | Download file:Candle_size.mq4

//+------------------------------------------------------------------+
//|                                          CandleTimeStationary.mq4|
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+

#property indicator_chart_window
//---- input parameters

extern color  Clock_Color = White;
extern string Corner_Placement = "1 is top right 3 is bottom right";
extern int    Corner = 3;


string objname="CandleBar";
double s1[];

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init(){

  ObjectCreate(objname, OBJ_LABEL,0, 0, 0);
  ObjectSet(objname, OBJPROP_CORNER, 1);
  ObjectSet(objname, OBJPROP_XDISTANCE, 180);
  ObjectSet(objname, OBJPROP_YDISTANCE, 0);     
   
   //----
   return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit(){

  ObjectDelete(objname);

  //----
  return(0);
} 


//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{

   //Time to bar expiry
  int m,s;

  m=Time[0]+Period()*60-CurTime();
  s=m%60;
  m=(m-s)/60;
  int spread=MarketInfo(Symbol(), MODE_SPREAD);

  string _sp="",_m="",_s="";
  if (spread<10) _sp="..";
  else if (spread<100) _sp=".";
  if (m<10) _m="0";
  if (s<10) _s="0";
  
  ObjectSetText(objname, "   C: "+MathAbs((iLow(NULL,0,1)-iHigh(NULL,0,1))/Point)+" ("+MathAbs((iLow(NULL,0,0)-iHigh(NULL,0,0))/Point)+")", 10, "Verdana", Clock_Color);
  return(0);
}
//+---------------------------------------------------------

Recommend