Download MetaTrader 5

why I cannot use ENUM_APPLIED_VOLUME even though it's in docs?

To add comments, please log in or register
Post web links to other trader's signals and make profit
Mihai Ionescu
1300
Mihai Ionescu 2015.04.07 21:12 

I try to port an indicator from MT5 to MT4,

and this error is all over the place. for example:

'ENUM_APPLIED_VOLUME' - declaration without type        utils_mql5.mqh  353     69

Apparently this type is not recognized, although I find it in mql4 docs

what can I do about it? Is this a bug? Am i doing something wrong? 


whroeder1
14503
whroeder1 2015.04.08 01:01  
"Declaration without type" isn't using it. You are apparently trying to declare it. Post the code.
Mihai Ionescu
1300
Mihai Ionescu 2015.04.08 12:45  

There are some 6 functions like this one:

double cdl_volume(MqlRates &r, ENUM_APPLIED_VOLUME _which=VOLUME_TICK) {
   if ( _which == VOLUME_TICK) 
      return ( r.tick_volume );
   else
      return ( r.real_volume ); 
}

the error appears only in these cases.

 

What's more,
if I type (anywhere) ENUM_APPLIED, the autocompletion feature recognizes ENUM_APPLIED_PRICE only

Shouldn't the autocompleter recognize the ENUM_APPLIED_VOLUME also? 

whroeder1
14503
whroeder1 2015.04.08 18:01  
  1. EAV is only meantioned on the Price Constants - MQL4 Documentation Since no functions use it it's probably not implemented in mt4. Is used in MT5.
  2. Try
    enum ENUM_APPLIED_VOLUME { VOLUME_TICK, VOLUME_REAL };
    double cdl_volume(const MqlRates& r, ENUM_APPLIED_VOLUME _which=VOLUME_TICK) {
       return _which == VOLUME_TICK ? r.tick_volume : r.real_volume; 
    }



Mihai Ionescu
1300
Mihai Ionescu 2015.04.09 10:18  

Thank you for point this solution out.

I thought about it myself, but I didn't know if VOLUME_TICK came first.

I will drop a message to service desk anyway 

To add comments, please log in or register