Navigation:Home > Content >

Round_Numbers.mq4

Time: 2016-05-24 | Download file:Round_Numbers.mq4

//+------------------------------------------------------------------+
//|                                                Round Numbers.mq4 |
//|                                        Copyright © 2008, LEGRUPO |
//|                                           http://www.legrupo.com |
//|                                                     Version: 1.0 |
//| History:                                                         |
//| 1.0 => Release version to the public                             |
//+------------------------------------------------------------------+

#property copyright "Copyright © 2007, LEGRUPO"
#property link      "http://www.legrupo.com"

extern color ColorBuy = Blue;
extern color ColorSell = Red;

#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectsDeleteAll();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   double pc_B = (MathCeil((iClose(NULL,0,1)*100))/100);
   double pc_S = (MathFloor((iClose(NULL,0,1)*100))/100);
   double sma_200 = iMA(Symbol(), 0, 200, 0, MODE_SMA, PRICE_CLOSE,0);
   
   ObjectDelete("pc_B_0");
   ObjectDelete("pc_B_1");
   ObjectDelete("pc_B_2");
   ObjectCreate("pc_B_0", OBJ_HLINE, 0, 0, pc_B);
   ObjectCreate("pc_B_1", OBJ_HLINE, 0, 0, pc_B+15*Point);
   ObjectCreate("pc_B_2", OBJ_HLINE, 0, 0, pc_B-15*Point);
   ObjectSet("pc_B_0", OBJPROP_COLOR, ColorBuy);
   ObjectSet("pc_B_1", OBJPROP_COLOR, ColorBuy);
   ObjectSet("pc_B_2", OBJPROP_COLOR, ColorBuy);
   
   ObjectDelete("pc_S_0");
   ObjectDelete("pc_S_1");
   ObjectDelete("pc_S_2");
   ObjectCreate("pc_S_0", OBJ_HLINE, 0, 0, pc_S);
   ObjectCreate("pc_S_1", OBJ_HLINE, 0, 0, pc_S+15*Point);
   ObjectCreate("pc_S_2", OBJ_HLINE, 0, 0, pc_S-15*Point);
   ObjectSet("pc_S_0", OBJPROP_COLOR, ColorSell);
   ObjectSet("pc_S_1", OBJPROP_COLOR, ColorSell);
   ObjectSet("pc_S_2", OBJPROP_COLOR, ColorSell);
//----
   return(0);
  }
//+------------------------------------------------------------------+

Recommend