Using indicators in MQL5 seems really complicated compared to MQL4, what am I doing wrong?
double myRSI = iRSI(NULL,0,14,PRICE_CLOSE,0);
But from what I understand so far with MQL5 I need to write multiple lines of code to achieve the same task. Most tutorials I found so far talk about creating an indicator handle, then using ArraySetAsSeries() function and CopyBuffer() after that and sometimes a few other things in between.
Is there a way to use builtin MT5 indicators in MQL5 in a way that is as simple as it was in MQL4?
Quote from Migrating from MQL4 to MQL5 (read entire Article for more information):
double iRSI(string symbol, int timeframe, int period, int applied_price, int shift) double iRSIMQL4(string symbol, int tf, int period, int price, int shift) { ENUM_TIMEFRAMES timeframe=TFMigrate(tf); ENUM_APPLIED_PRICE applied_price=PriceMigrate(price); int handle=iRSI(symbol,timeframe,period,applied_price); if(handle<0) { Print("The iRSI object is not created: Error",GetLastError()); return(-1); } else return(CopyBufferMQL4(handle,0,shift)); }iRSI
Calculates the Relative strength index and returns its value.
iRSI
Also read the following:
- docs.mql4.com
double myRSI = iRSI(NULL,0,14,PRICE_CLOSE,0);
But from what I understand so far with MQL5 I need to write multiple lines of code to achieve the same task. Most tutorials I found so far talk about creating an indicator handle, then using ArraySetAsSeries() function and CopyBuffer() after that and sometimes a few other things in between.
Is there a way to use builtin MT5 indicators in MQL5 in a way that is as simple as it was in MQL4?