//+------------------------------------------------------------------+
//|                                                      fxfreak.mq5 |
//|                                                           .....h |
//|                                                    hayseedfx.com |
//+------------------------------------------------------------------+
#property copyright ".....h"
#property link      "hayseedfx.com"

#property indicator_chart_window
#property indicator_plots 0

input int xpips    =  20;
input int ypips    =  20;

int _xpips, _ypips;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void OnInit()
  {
//---- indicators

   if(Digits() == 3 || Digits() == 5)
   {
   _xpips = xpips *10;
   _ypips = ypips *10;
   }
   
   else 
   {
   _xpips = xpips;
   _ypips = ypips;
   }

//----
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//----
   
//----
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[]
                )
{
   //int    counted_bars=IndicatorCounted();
//----
   DrawHorizontalLine("above", SymbolInfoDouble(Symbol(),SYMBOL_BID)+_xpips*Point()); 
   DrawHorizontalLine("below", SymbolInfoDouble(Symbol(),SYMBOL_BID)-_ypips*Point()); 
//----
   return(rates_total);
  }
//+------------------------------------------------------------------+

   void DrawHorizontalLine(string name, double level)           
   {  
   ObjectDelete(0,name);
   ObjectCreate(0,name, OBJ_HLINE, 0, 0, level);
   ObjectSetInteger(0,name, OBJPROP_STYLE, STYLE_SOLID);
   ObjectSetInteger(0,name, OBJPROP_WIDTH, 2);
   ObjectSetInteger(0,name, OBJPROP_COLOR, Red);
   }
 