Magic Number: minimum and maximum

 

Hi,


Anyone got the link or know where is the 'official' definition of the minimum and maximum values for the magic number?


I am looking for the 'official' definition.

 
It's an integer.
 

Keep it to 9 digits or less to avoid problems

-BB-

 
gordon:
It's an integer.

this...so the same value range that applies to any other integer. -2147483647 to 2147483647

(2^32)
 
1005phillip:

this...so the same value range that applies to any other integer. -2147483647 to 2147483647

(2^32)

More accurately: -2,147,483,648 to 2,147,483,647

(or generally: -2N−1 to +2N−1-1, in our case N=32).

 

between 0x00000000 and 0xFFFFFFFF

(while all numbers with the highest bit set to 1 (all those ranging from 0x80000000 to 0xFFFFFFFF) will be interpreted as negative numbers: 0xFFFFFFFF is -1, 0xFFFFFFFE is -2 and so on.)

in other words: you can use anything that fits into a 32 bit signed integer.

 

Magic number is a ULONG.

ulong #

The ulong type also occupies 8 bytes and can store values from 0 to 18 446 744 073 709 551 615.

Documentation on MQL5: Language Basics / Data Types / Integer Types / Char, Short, Int and Long Types
Documentation on MQL5: Language Basics / Data Types / Integer Types / Char, Short, Int and Long Types
  • www.mql5.com
Char, Short, Int and Long Types - Integer Types - Data Types - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Robert Mathias Bernt Larsson #:

Magic number is a ULONG.

ulong #

The ulong type also occupies 8 bytes and can store values from 0 to 18 446 744 073 709 551 615.

Why reply to a topic that is over 11 years old?

Why reply with the wrong information?

Magic Number is an int, not a ulong.

 
Keith Watford #:

Why reply to a topic that is over 11 years old?

Why reply with the wrong information?

Magic Number is an int, not a ulong.

He is talking about MQL5… and he is right… int is for mql4
 
Daniel Cioca #:
He is talking about MQL5… and he is right… int is for mql4

Yes, and this topic is in the MQL4 section, so he is wrong.

 
Keith Watford #:

Yes, and this topic is in the MQL4 section, so he is wrong.

Corect… topic is wrong … Buț what it is saying is correct…. 😜
Reason: