Hi,
Base on this documentation as you can find out :
https://docs.mql4.com/basis/variables/externvariables
Note: The length of a string comment for extern variables cannot exceed 63 characters.
![Extern Variables - Variables - Language Basics - MQL4 Reference Extern Variables - Variables - Language Basics - MQL4 Reference](https://c.mql5.com/36/25/extern-variables-variables-language.png)
- docs.mql4.com
Mehrdad Jeddi:
Note: The length of a string comment for extern variables cannot exceed 63 characters.
"The length of a string comment..."
Thank you, but I'm not talking about the comment. I'm talking about the string value / content.
Forum on trading, automated trading systems and testing trading strategies
Slava , 2019.03.26 11:39
The fact that in a single test is not truncated to 63 characters, it is just an accident.
The length of the input parameter of type string must not exceed 63 characters (64 together with a null terminator)
"The length of a string comment..."
Thank you, but I'm not talking about the comment. I'm talking about the string value / content.
Yes,i know,but the full expression is :
"The length of a string comment for extern variables cannot exceed 63 characters."
Yes,i know,but the full expression is :
"The length of a string comment for extern variables cannot exceed 63 characters."
That's not the point.The key word there is "comment".
The documentation only says it has a limit to the comment, not to the content / value.
input string var_name = "Content / value"; // Comment
That's not the point.The key word there is "comment".
The documentation only says it has a limit to the comment, not to the content / value.
No,Comment is not important,the comment can be more than 2k lines and words !
The doc means the variable name comment,as you checked it in your backtesting with the "input string A" variable and see the "StringLen(A)"
returns the maximum valid value for extern input parameter was 63 characters !
No,Comment is not important,
Yes, it is. Comment define the input label in the input interface.
the comment can be more than 2k lines and words !
The comment on the code of course can be as long as I want...
But It'll be truncated to 63 characters in the interface as the documentation says.
Look:
input string A=""; // ABCDEFGHIJKLMNOPQRSTUVXYWZ ABCDEFGHIJKLMNOPQRSTUVXYWZ ABCDEFGHIJKLMNOPQRSTUVXYWZ
Let's read again what the documentation says:
"The length of a string comment for extern variables cannot exceed 63 characters."
So, the documentation explains the result above (the truncated comment / label is expected).
But the string content / value limit is not explained in the documentation,
it's explained (or at least justified) only in the @Slava post in this forum shared here by @Alain Verleyen
Yes, it is. Comment define the input label in the input interface.
The comment on the code of course can be as long as I want...
But It'll be truncated to 63 characters in the interface as the documentation says.
Look:
Let's read again what the documentation says:
"The length of a string comment for extern variables cannot exceed 63 characters."
So, the documentation explains the result above (the truncated comment / label is expected).
But the string content / value limit is not explained in the documentation,
it's explained (or at least justified) only in the @Slava post in this forum shared here by @Alain Verleyen
So as you see it doesnt allow more than 63characters as their docs,and you see in backtest mode by StringLen() function !
So it's not bug,it's limited by their expected.
So as you see it doesnt allow more than 63characters as their docs
No.
The documentation is about the comment my problem is about the content.
COMMent. CONTent.
input string var_name = "CONTENT"; // COMMENT
But yes, it is not a bug, it is expected.
Not because it's in the documentation (it's not) but because @Slava (who I guess is from the dev team) say so.
But thank you anyway for your contribution.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
If I run a backtest of the EA above the OnTester result is 200.
If I run an optimization of the "B" input (the values don't matter, it's used so I can do an optimization) the result is also 200.
So far so good.
Now let's transform the "A" variable in an input.
Now If I run a backtest of the EA above the OnTester result is 200, as expected.
Nothing fancy till here.
But If I run an optimization of the "B" input the result is 63.
It start happening in the latest build, so looks like is was introduced an string size limit to string input parameters that affects only optimizations. I don't think is was intentional.
Is very weird to have the same EA generating different results for a single backtest vs an optimization with exactly the same inputs.
If you (Metaquotes) want to cap the string size you should limit the size of the string that the user can type.
Thank you.