ENUM_MA_METHOD

Back to topics list To post a new topic, please log in or register
avatar
63
omissamf 2016.07.02 12:38
 

Hello guys, I have this problem I can not solve. I wrote this code:

enum Tipo_MM
  {
   A=MODE_SMA,// Media semplice
   B=MODE_EMA,// Media esponenziale
  };
 
input Tipo_MM Tipo_MediaMobile=A;


Then I insert "Tipo_MediaMobile" in this code:


(iMA(NULL,PERIOD_CURRENT,3,0,Tipo_MediaMobile,PRICE_CLOSE,0)


but it gives me this warning:

"improper enumerator cannot be used "

You can help me solve this problem? Thank you all, Max



avatar
2017
gooly 2016.07.02 12:55 #
 

Have you read about enum in the editors reference - it helps:

...
After the enumeration is declared, a new integer-valued 4-byte data type appears. ...

Just place the cursors above enum and press F1.


avatar
13008
WHRoeder 2016.07.02 13:49 #
 

You created the type Tipo_MM as a subset of ENUM_MA_METHOD using the ENUM_MA_METHOD constants. This is fine, although I don't know why you want to reject/disallow the other methods.

But iMA expects a ENUM_MA_METHOD, thus your error. So cast it back to the superset or drop your type and use the ENUM_MA_METHOD as the type of your variable.

iMA(NULL, PERIOD_CURRENT, 3, 0, (ENUM_MA_METHOD) Tipo_MediaMobile, PRICE_CLOSE, 0)
avatar
63
omissamf 2016.07.02 14:37 #
 
WHRoeder:

You created the type Tipo_MM as a subset of ENUM_MA_METHOD using the ENUM_MA_METHOD constants. This is fine, although I don't know why you want to reject/disallow the other methods.

But iMA expects a ENUM_MA_METHOD, thus your error. So cast it back to the superset or drop your type and use the ENUM_MA_METHOD as the type of your variable.

Thanks WHRoeder, kind as always!
Greetings, Massimo.
Back to topics list  

To add comments, please log in or register