Job finished


Specification
Convert the ADR indicator (ADR V2.mq4) from this page:
https://forex-station.com/app.php/attach/file/3363278
from MT4 to MT5
It is a very simple indicator which is only 64 lines including all of the comments & declarations at the top.
The code is actually the following:
//+------------------------------------------------------------------+
//| Daily Range PeterE.mq4 |
//+------------------------------------------------------------------+
#property indicator_chart_window
extern int NumOfDays = 25;
extern string FontName = "Tahoma";
extern int FontSize = 14;
extern color FontColor = White;
extern int Window = 0;
extern int Corner = 0;
extern int HorizPos = 85;
extern int VertPos = 0;
double pnt;
int dig;
string objname = "*DRPE";
//+------------------------------------------------------------------+
int init() {
//+------------------------------------------------------------------+
pnt = MarketInfo(Symbol(),MODE_POINT);
dig = MarketInfo(Symbol(),MODE_DIGITS);
if (dig == 3 || dig == 5) {
pnt *= 10;
}
ObjectCreate(objname,OBJ_LABEL,Window,0,0);
return(0);
}
//+------------------------------------------------------------------+
int deinit() {
//+------------------------------------------------------------------+
ObjectDelete(objname);
return(0);
}
//+------------------------------------------------------------------+
int start() {
//+------------------------------------------------------------------+
int c=0;
double sum=0;
for (int i=1; i<Bars-1; i++) {
double hi = iHigh(NULL,PERIOD_D1,i);
double lo = iLow(NULL,PERIOD_D1,i);
datetime dt = iTime(NULL,PERIOD_D1,i);
if (TimeDayOfWeek(dt) > 0 && TimeDayOfWeek(dt) < 6) {
sum += hi - lo;
c++;
if (c>=NumOfDays) break;
} }
hi = iHigh(NULL,PERIOD_D1,0);
lo = iLow(NULL,PERIOD_D1,0);
if (i>0 && pnt>0) {
string objtext = DoubleToStr(sum/c/pnt,1) + " | " + DoubleToStr((hi-lo)/pnt,1) + " | " +DoubleToStr((((hi-lo)/pnt)/(sum/c/pnt))*100,0)+" %";
// add: + c + :here ^ to display user select adr number of days
ObjectSet(objname,OBJPROP_CORNER,Corner);
ObjectSet(objname,OBJPROP_XDISTANCE,HorizPos);
ObjectSet(objname,OBJPROP_YDISTANCE,VertPos);
ObjectSetText(objname,objtext,FontSize,FontName,FontColor);
}
return(0);
}