skeptic23: Anyone know why MQL4 doesn't recognize a constant as a constant? Or is it telling me "constant" when it means "literal"? I don't understand why it doesn't like constants.
You cannot use a "constant variable" for the default value. You have to use a "constant" (aka "literal").
skeptic23: I don't understand why it doesn't like constants.
-
It likes constants. You are passing a constant variable. Pass a literal.
-
Or use the preprocessor.
#define csConstStr "this is a constant" #define ciConstINT 0 void COMPILES(string sString=csConstStr …
-
Or internalize it with placeholders.
const string csConstSTR …; const int ciConstInt …; void INTERNALIZED(string sStr="DEFAULT", int iInt=EMPTY){ if( sString == "DEFAULT") sStr = csConstStr; if( iInt == EMPTY) iInt = ciConstInt;
William Roeder:
-
It likes constants. You are passing a constant variable. Pass a literal.
-
Or use the preprocessor.
-
Or internalize it with placeholders.
HAHA! Thanks man. Right side =/= left side, thanks for making the connection for me. Forgot all about #define.
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
Anyone know why MQL4 doesn't recognize a constant as a constant?
Or is it telling me "constant" when it means "literal"?
I don't understand why it doesn't like constants.