MQL5 Syntax question?
Hi, yes there is an alternative - you can use the enumeration as an identifier for the type, instead of getting the int of it and working with the integer
True, Even the way he did is sill fine though it might look improper but it gets the work done.
OrderGetInteger is a generic function returning a long. You must cast it to the appropriate type depending on the thing requested: a long, datetime, ENUM_ORDER_TYPE, ENUM_ORDER_STATE, etc. The cast is appropriate.
What you should do to make it "look right" is to encapsulate the data typing thus:
datetime OrderGetExpiration(void){ return (datetime)OrderGetInteger(ORDER_TIME_EXPIRATION); } ENUM_ORDER_TYPE OrderGetOrderType(void){ return (ENUM_ORDER_TYPE)OrderGetInteger(ORDER_TYPE); } ENUM_ORDER_STATE OrderGetOrderState(void){ return (ENUM_ORDER_STATE)OrderGetInteger(ORDER_STATE ); } ⋮ /////////////// ENUM_ORDER_TYPE cur_type = OrderGetOrderType(); datetime expires = OrderGetExpiration();
Hi All,
I have a small issue that's puzzling me. When I compile I get a warning about this line being 'implicit enum conversion'
to fix it I have done this:
But this seems inelegant, what should I be doing here?
Thanks,
Noki0100