//+------------------------------------------------------------------+
//|                                        ATR_Value_Display_Mtf.mq4 |
//|                                         Created By ExplosionKibo |
//+------------------------------------------------------------------+
#property copyright "Created By ExplosionKibo @ FF"
#property indicator_chart_window

enum p
{
   p0,    // Pips
   p1,    // Points
};
extern ENUM_TIMEFRAMES  TimeFrame            =  PERIOD_CURRENT;
extern int              ATRPeriod            =  13;
extern p                DisplayAtrAs;
extern double           AtrMultiplier        =  1;
extern string           FontName             =  "Arial";
extern color            FontColor            =  clrDodgerBlue;
extern int              FontSize             =  10;
extern ENUM_BASE_CORNER DisplyCorner         =  CORNER_RIGHT_UPPER;
extern int              DisplayWindow        =  0;
extern int              XDISTANCE            =  5; 
extern int              YDISTANCE            =  5;

int point; double Pips, Points; string t;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
  int OnInit()
  {

 return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Deinit                   
//+------------------------------------------------------------------+
  int deinit()
  {
  ObjectDelete("ATRValueDisplay");
  
  return(0);
  }

//+------------------------------------------------------------------+
//| 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[])
  {
  
   double ATR = iATR(Symbol(),TimeFrame,ATRPeriod,0)*AtrMultiplier;
      
   if(DisplayAtrAs==p0) double A = Pips; else A = Points;
   
   if(Digits == 1|| Digits == 2 || Digits == 3 || Digits == 5 ) point = 10; 
   
   int D = (int) MarketInfo(Symbol(),MODE_DIGITS);
         
   if(DisplayAtrAs==p0) t= "pips";
   if(DisplayAtrAs==p1) t= "points";
   
   Points = MathAbs((NormalizeDouble(((ATR)/
   MarketInfo(Symbol(),MODE_POINT)),D)));
   
   Pips = Points/point;
       
   ObjectCreate (0,"ATRValueDisplay", OBJ_LABEL,DisplayWindow,0,0);
   ObjectSet    ("ATRValueDisplay", OBJPROP_CORNER,DisplyCorner);
   ObjectSet    ("ATRValueDisplay", OBJPROP_XDISTANCE,XDISTANCE);
   ObjectSet    ("ATRValueDisplay", OBJPROP_YDISTANCE,YDISTANCE);
   ObjectSetText("ATRValueDisplay","Atr"+"("+ATRPeriod+"): "+DoubleToStr(A,1)+" "+t,FontSize,FontName,FontColor); 
  
 return(rates_total);
  }
//+------------------------------------------------------------------+










































