Converting iHighest iLowest from MQL4 to MQL5

Code in MQL4:

double High4=iHigh(Symbol(),PERIOD_H1,iHighest(Symbol(),PERIOD_H1,MODE_HIGH,4,1));
double Low4=iLow(Symbol(),PERIOD_H1,iLowest(Symbol(),PERIOD_H1,MODE_LOW,4,1));
double Med4=(High4+Low4)/2;
bool orderBuy=Ask>Med4;
bool orderSell=Bid<Med4;

etc…


 Code in MQL5:

double iHigh(string symbol,ENUM_TIMEFRAMES timeframe,int index)
{
double high=0;
ArraySetAsSeries(High,true);
int copied=CopyHigh(symbol,timeframe,0,TotalBars,High);
if(copied>0 && index<copied) high=High[index];
return(high);
}

int iHighest(string symbol,ENUM_TIMEFRAMES tf,int count=WHOLE_ARRAY,int start=0)
{
double High[];
ArraySetAsSeries(High,true);
CopyHigh(symbol,tf,start,count,High);
return(ArrayMaximum(High,0,count)+start);
return(0);
}

double iLow(string symbol,ENUM_TIMEFRAMES timeframe,int index)
{
double low=0;
ArraySetAsSeries(Low,true);
int copied=CopyLow(symbol,timeframe,0,TotalBars,Low);
if(copied>0 && index<copied) low=Low[index];
return(low);
}

int iLowest(string symbol,ENUM_TIMEFRAMES tf,int count=WHOLE_ARRAY,int start=0)
{
double Low[];
ArraySetAsSeries(Low,true);
CopyLow(symbol,tf,start,count,Low);
return(ArrayMinimum(Low,0,count)+start);
return(0);
}

1 comment:

  1. Finally I got my lost funds recovered in binary option,  I lost my money I invested in binary option to a scam broker who ripped off my money and I never saw them again I became more depressed.  Some time ago a good friend of mine referred me to  (recoverylostfundsback ) the platform came for my rescue and with their master class intelligence and strategies and they helped me place a profitable trade and also recovered all my lost funds from those scam broker and a successful withdraw. They are expert when it comes to recovery of lost funds and they offer best services to your own satisfaction. I feel honoured to recommend any one to this wonderful platform  and thank me later,  you can contact for assistance and on how you can make a good profitable trade, recovery of lost funds, free signals  and stop losing money to heartless brokers.                                    recoverylostfundsback@gmail.com

    ReplyDelete