//+------------------------------------------------------------------+
//| Numerical Distance from 200EMA.mq4                 by Jamalima   |
//+------------------------------------------------------------------+

#property indicator_chart_window

  string note1 = "Change font colors automatically? True = Yes";
  extern bool   Distance_Colors = True;
  string note2 = "Default Font Color";
  double EMAValue = 200;
  double DIGITS = 0;
  extern color  FontColor = White;
  string note3 = "Font Size";
  extern int    FontSize=21;
  string note4 = "Font Type";
  string FontType="Arial Bold";
  extern string note5 = "Display the price in what corner?";
  extern string note6 = "Upper left=0; Upper right=1";
  extern string note7 = "Lower left=2; Lower right=3";
  extern int    WhatCorner=1;
  
  

int init()
  {
   return(0);
  }

int deinit()
  {
  ObjectDelete("Numerical_Distance"); 
  
  return(0);
  }

int start()
  {
   double Pt = MarketInfo(Symbol(), MODE_POINT);
   double EMA = iMA(Symbol(),0,EMAValue,0,MODE_EMA,PRICE_CLOSE,0);
   double CLOSE = iClose(Symbol(),0,0);
   if (Distance_Colors == True)
   {
    if (CLOSE - EMA > 0) 
    FontColor = Green;
    if (CLOSE - EMA < 0)
    FontColor = Red;
    
   }
   	 
   
   string Distance = DoubleToStr((CLOSE-EMA)/10/Pt, DIGITS);
  
   ObjectCreate("Numerical_Distance", OBJ_LABEL, 0, 0, 0);
   ObjectSetText("Numerical_Distance", Distance, FontSize, FontType, FontColor);
   ObjectSet("Numerical_Distance", OBJPROP_CORNER, WhatCorner);
   ObjectSet("Numerical_Distance", OBJPROP_XDISTANCE, 1);
   ObjectSet("Numerical_Distance", OBJPROP_YDISTANCE, 1);
  }