enum is enum. It shouldn't be declared as int or double. Try:
ENUM_SYMBOL_INFO_DOUBLE iAskBid = SYMBOL_ASK;

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi All..!!
I am new to MQL5 and am unclear about enums.
The question is as follows:
I want to identify a buy position close from a sell position close...
i have a common function 'void closePosition(int piType, string psSymbol, ....)' that closes either/or, so I pass the Position type in the parameter List.
Within the function :
int iAskBid = SYMBOL_ASK;
if (piType==POSITION_TYPE_SELL)
iAskBid = SYMBOL_BID;
request.type = piType; // This gives a warning: implicit enum conversion... Guess that is ok
request.price = SymbolInfoDouble(psSymbol,iAskBid); // This gives me the no one of overload... error=====
tried casting iAskBid to enum , (enum)iAskBid) .. but that does not work.. Are enums not integers?
What am I doing wrong? do I HAVE to USE the enum Identifier?
any help/explanation would be appreciated !! Tried looking it up in the MQ5 Doc and Google but found nothing regarding MQL5
Thanks in advance....
Tried casting it to (ENUM_SYMBOL_INFO_DOUBLE) iAskBid, and that cleared the error... Is this correct?