Hi,
char is the type in MQL so its a keyword and cannot be used as the name of a parameter. Try something different like character.
So your code becomes:
string addStr(string str, string character, int maxlength, bool atbeginning = true) { int l = maxlength - StringLen(str); for (int i=0; i<l; i++) { if (atbeginning) str = character + str; else str = str + character; } return(str); }

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
I try to adapt and customize a code and I still have three errors Quye I can not seem to correct, the block of code in question :
and the errors detected :
'char' - unexpected token
'+' - unexpected token
';' - unexpected token
Thanks