Magic Number digits limitation
3 replies
josecort_trader
5 months ago #292314
Hello!
I would like to ask if the ‘MagicNumber’ in SQX could be set as ‘long’ type instead of ‘int’ type.
The reason is that I would like to have more than 10 digits to define a Magic Number when saving a bunch of strategies.
Thanks!
Regards,
Jose
0
tomas262
5 months ago #292329
The maximum value for the magic number is 2,147,483,647. It is determined by how MQL language operates
0
josecort_trader
5 months ago #292343
Hi tomas262,
Thanks for you reply.
My question is more related to the number of digits to define the ‘MagicNumber’ than how many numbers can be used for the ‘MagicNumber’.
As you well said,
https://www.mql5.com/en/docs/basis/types/integer/integertypes
//—
<h2>int #</h2>
<p class=”p_Text”><span class=”f_Text”>The size of the </span><span class=”f_Text”>int</span><span class=”f_Text”> type is 4 bytes (32 bits). The minimal value is -2 147 483 648, the maximal one is 2 147 483 647.</span></p>
<span class=”f_Text”>2147483647 is a 10 digits number</span>
So the maximum number allowed for the ‘int’ type is defined by 10 digits.
—//
MQL5 code allows to use different types of integers that could be used to define the ‘MagicNumber’. For instance,
//—
<h2>long #</h2>
<p class=”p_Text”><span class=”f_Text”>The size of the </span><span class=”f_Text”>long</span><span class=”f_Text”> type is 8 bytes (64 bits). The minimum value is -9 223 372 036 854 775 808, the maximum value is 9 223 372 036 854 775 807.</span></p>
<span class=”f_Text”>9223372036854775807 is a 20 digits number</span>
So the maximum number allowed for the ‘long’ type is defined by 20 digits.
—//
<span class=”f_Text”>SQX codes the ‘MagicNumer’ as an ‘int’ type. </span>
<span class=”f_Text”>My request would be that SQX allows user to change the integer type for the MagicNumber as ‘long’ or ‘ulong’ instead of as ‘int’ to extend the number of digits that ‘MagicNumber’ can use.</span>
I am able to do shift to <span class=”f_Text”>’long’ or ‘ulong’ type for ‘MagicNumber’ </span>in MQL editor post exporting the strategies, but I would like that SQX did it.
Thanks for your time and help.
Regards,
Jose
0
josecort_trader
5 months ago #292344
Sorry, the previous message does not look good.
int #
The size of the int type is 4 bytes (32 bits). The minimal value is -2 147 483 648, the maximal one is 2 147 483 647.
So the maximum number allowed for the ‘int’ type is defined by 10 digits.
long #
The size of the long type is 8 bytes (64 bits). The minimum value is -9 223 372 036 854 775 808, the maximum value is 9 223 372 036 854 775 807.
So the maximum number allowed for the ‘long’ type is defined by 20 digits.
The feature request would be to use a ‘long’ integer type for the MagicNumber instead of ‘int’ type when exporting the strategies.
Thanks,
Jose
0
Viewing 3 replies - 1 through 3 (of 3 total)