Migrating from MQL4 to MQL5 - Problem 2!

 

How do I get the handle of an indicator? I do:

input int           TF          =   5; // not necessarily an MQL5-Period
..
int HdlRSI, HdliMA;
...
int OnInit() {
...
   if ( isTermPeriod(TF) ) {
      HdlRSI        = iRSI(_Symbol,TFMigrate(TF),PER,getAppPRC(PRC)); // Line 108, at 23 is i of iRsi
      HdliMA        =  iMA(_Symbol,TFMigrate(TF),PER,getAppPRC(PRC)); // Line 109, at 24 is i of iMA
   } else { HdlRSI = HdliMA = -1; }
...
}
bool isTermPeriod(const int tf) { ... }         // returns whether tf is a timeframe of MQL5 or not
ENUM_TIMEFRAMES TFMigrate(const int tf) {..}    // returns the MQL5-enum of an int-value
ENUM_APPLIED_PRICE getAppPRC(€ApplPRC p) {.. }  // return the MQL5-enum of an int-value of the price

Now the compiler tells me:

'iRSI' - wrong parameters count Test_Rsi.mq4    108     23
'iMA' - wrong parameters countTest_Rsi.mq4      109     24

What's wrong with it?

 
Carl Schreiber:

How do I get the handle of an indicator? I do:

Now the compiler tells me:

What's wrong with it?

ENUM_APPLIED_PRICE getAppPRC(€ApplPRC p) {.. } 
what's that ?
 
Icham Aidibe:
what's that ?

€ApplPRC is my enumeration and function getAppPRC(..) translates it into MQL5 enum:

ENUM_APPLIED_PRICE getAppPRC(€ApplPRC p){
   switch (p) {
      case €Cls: return(PRICE_CLOSE);
...
}
 
Carl Schreiber:

€ApplPRC is my enumeration and function getAppPRC(..) translates it into MQL5 enum:

Why wouldn't give a try without special chars ? 

 
I widely use them - no problem anywhere!
 
Carl Schreiber:
I widely use them - no problem anywhere!
      HdlRSI        = iRSI(_Symbol,(ENUM_TIMEFRAME)TFMigrate(TF),PER,(ENUM_APPLIED_PRICE)getAppPRC(PRC)); // Line 108, at 23 is i of iRsi
      HdliMA        =  iMA(_Symbol,(ENUM_TIMEFRAME)TFMigrate(TF),PER,(ENUM_APPLIED_PRICE)getAppPRC(PRC)); // Line 109, at 24 is i of iMA		

does this work ? 

I'm not sure why but I suspect your snippet to return the timeframe as a integer (in seconds)
 
ENUM_APPLIED_PRICE getAppPRC(€ApplPRC p){
   switch (p) {
      case €Cls: return((ENUM_APPLIED_PRICE)PRICE_CLOSE);
...
}
... this should work also
 

I tried your variation no change :(

 
Carl Schreiber:

I tried your variation no change :(

'iRSI' - wrong parameters count Test_Rsi.mq4    108     23
'iMA' - wrong parameters countTest_Rsi.mq4      109     24

That's mql5 code, not mql4.

 
Alain Verleyen:

That's mql5 code, not mql4.

:D

Carl Schreiber:

I tried your variation no change :(

Btw your problem3 compiles well also!!!

 
Alain Verleyen:

That's mql5 code, not mql4.

I am using the MQL5 editor!

I control it as the editor for mt4 offers the references of MQL4 AND MQL5 - the MQL5-editor offers only the reference of MQL5!

I re-checked it, so this cannot be the problem!

In mql4 I haven had any problem!

Reason: