Please advise what type should be correct for the magic number, ulong or long?
A. ulong is used in struct MqlTradeRequest and MQL LIB.
struct MqlTradeRequest
{
ENUM_TRADE_REQUEST_ACTIONS action; // Trade operation type
ulong magic; // Expert Advisor ID (magic number)
ulong order; // Order ticket
string symbol; // Trade symbol
double volume; // Requested volume for a deal in lots
double price; // Price
double stoplimit; // StopLimit level of the order
double sl; // Stop Loss level of the order
double tp; // Take Profit level of the order
ulong deviation; // Maximal possible deviation from the requested price
ENUM_ORDER_TYPE type; // Order type
ENUM_ORDER_TYPE_FILLING type_filling; // Order execution type
ENUM_ORDER_TYPE_TIME type_time; // Order execution time
datetime expiration; // Order expiration time (for the orders of ORDER_TIME_SPECIFIED type)
string comment; // Order comment
};
B. long is used in following functions:
ORDER_MAGIC |
ID of an Expert Advisor that has placed the order (designed to ensure that each Expert Advisor places its own unique number) |
long |
DEAL_MAGIC |
Deal magic number (see ORDER_MAGIC) |
long |
POSITION_MAGIC |
Position magic number (see ORDER_MAGIC) |
long |
Please advise what type should be correct for the magic number, ulong or long?
A. ulong is used in struct MqlTradeRequest and MQL LIB.
struct MqlTradeRequest
{
ENUM_TRADE_REQUEST_ACTIONS action; // Trade operation type
ulong magic; // Expert Advisor ID (magic number)
ulong order; // Order ticket
string symbol; // Trade symbol
double volume; // Requested volume for a deal in lots
double price; // Price
double stoplimit; // StopLimit level of the order
double sl; // Stop Loss level of the order
double tp; // Take Profit level of the order
ulong deviation; // Maximal possible deviation from the requested price
ENUM_ORDER_TYPE type; // Order type
ENUM_ORDER_TYPE_FILLING type_filling; // Order execution type
ENUM_ORDER_TYPE_TIME type_time; // Order execution time
datetime expiration; // Order expiration time (for the orders of ORDER_TIME_SPECIFIED type)
string comment; // Order comment
};
B. long is used in following functions:
ORDER_MAGIC |
ID of an Expert Advisor that has placed the order (designed to ensure that each Expert Advisor places its own unique number) |
long |
DEAL_MAGIC |
Deal magic number (see ORDER_MAGIC) |
long |
POSITION_MAGIC |
Position magic number (see ORDER_MAGIC) |
long |
I suggest you use uint data types, it can change to ulong or long data types without any loss of information. You can read this information in mql5 reference (MQL5 Reference / Language Basics / Data Types / Typecasting).
but all the variables and functions regarding m_magic in source code of MQL5 LIB are ulong. is it a bug?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Please advise what type should be correct for the magic number, ulong or long?
A. ulong is used in struct MqlTradeRequest and MQL LIB.
struct MqlTradeRequest
{
ENUM_TRADE_REQUEST_ACTIONS action; // Trade operation type
ulong magic; // Expert Advisor ID (magic number)
ulong order; // Order ticket
string symbol; // Trade symbol
double volume; // Requested volume for a deal in lots
double price; // Price
double stoplimit; // StopLimit level of the order
double sl; // Stop Loss level of the order
double tp; // Take Profit level of the order
ulong deviation; // Maximal possible deviation from the requested price
ENUM_ORDER_TYPE type; // Order type
ENUM_ORDER_TYPE_FILLING type_filling; // Order execution type
ENUM_ORDER_TYPE_TIME type_time; // Order execution time
datetime expiration; // Order expiration time (for the orders of ORDER_TIME_SPECIFIED type)
string comment; // Order comment
};
B. long is used in following functions:
ORDER_MAGIC
ID of an Expert Advisor that has placed the order (designed to ensure that each Expert Advisor places its own unique number)
long
DEAL_MAGIC
Deal magic number (see ORDER_MAGIC)
long
POSITION_MAGIC
Position magic number (see ORDER_MAGIC)
long