Code help please - 'cannot convert enum' error

 

New to mql language

I'm getting: 'iclose' - cannot convert enum' error on this line of code:

   h = iHigh(_Symbol, _Period, iHighest(_Symbol, _Period, iClose(_Symbol, smoothTimeframe, 0), trendPeriod, 0));(Symbol(), PERIOD_M1, 0)

any help appreciated!

 
Read the documentation please !
 
Alain Verleyen #:
Read the documentation please !
thanks I did, but it's still not clear to me where i've gone wrong
 
atsmit:

New to mql language

I'm getting: 'iclose' - cannot convert enum' error on this line of code:

   h = iHigh(_Symbol, _Period, iHighest(_Symbol, _Period, iClose(_Symbol, smoothTimeframe, 0), trendPeriod, 0));(Symbol(), PERIOD_M1, 0)

any help appreciated!

    int trendPeriod = 10;  // just example fill with 10
    ENUM_TIMEFRAMES smoothTimeframe = PERIOD_CURRENT;
    double h = iHigh(_Symbol, _Period, iHighest(_Symbol, _Period, iClose(_Symbol, smoothTimeframe, 0), trendPeriod, 0));
    //;(Symbol(), PERIOD_M1, 0) <---- In this section you wrote the code incompletely. I comment here.

You must declare the enumeration for the timeframe in the global or local variable section so that your timeframe parameters are valid.

 
Muhammad Faisal Sagala #:
 int trendPeriod = 10; // just example fill with 10     ENUM_TIMEFRAMES smoothTimeframe = PERIOD_CURRENT;     double h = iHigh(_Symbol, _Period, iHighest(_Symbol, _Period, iClose(_Symbol, smoothTimeframe, 0), trendPeriod, 0));  

Did you bother to try your "solution" ?

Doesn't make sense. You also need to read the documentation.

 
atsmit #:
thanks I did, but it's still not clear to me where i've gone wrong

Read it again.

If you can't read then don't try to code.

What is the third parameter of iHighest() ?

 
h = iHigh(_Symbol, _Period, iHighest(_Symbol, _Period, iClose(_Symbol, smoothTimeframe, 0), trendPeriod, 0));(Symbol(), PERIOD_M1, 0)

this is your code

int  iHighest( 
   const string        symbol,              // Symbol 
   ENUM_TIMEFRAMES     timeframe,           // Period 
   ENUM_SERIESMODE     type,                // Timeseries identifier 
   int                 count=WHOLE_ARRAY,   // Number of elements 
   int                 start=0              // Index 
  );

this is iHighest code in documentation

You have to define ENUM_SERIESMODE which can be like MODE_OPEN then two int parameters for count and start.

so it should be like

h = iHigh(_Symbol, _Period, iHighest(_Symbol, _Period, MODE_CLOSE, trendPeriod, 0));
 
Arpit T #:

this is your code

this is iHighest code in documentation

You have to define ENUM_SERIESMODE which can be like MODE_OPEN then two int parameters for count and start.

so it should be like

Thank you for explaining Arpit - much more helpful than the mods on here. Your fix worked and I understanD why now so much appreciated!
 
atsmit #:
Thank you for explaining Arpit - much more helpful than the mods on here. Your fix worked and I understanD why now so much appreciated!

Glad to know your issue is solved. I given you answer in layman term, however other mods have a nature of helping in a way which make learners develop self problem solving skills so you grasp the root cause of your question next time you may explore documentation which will help you learn fast and reduce your number of general question posts in forum.

Reason: