what does it means
#define MAGICMA 20050610
what kind of variable is MAGICMA ?? and why it is defined for value 20050610
I found this in the EA named Moviing Average
MAGICMA is the value for an identifer you can put in OrderSend to identiy your Order later ....
you als can say f.e. extern int MAGICMA=20050610 if you like to change sometimes in EA
Also is an integer and you can give numbers what you like/need. 20050610 is only an example or the idea from the author..
ok, then MAGICMA is a reserved word. It is correct?
No, not reserverd, you can call however you want .. MagicN, myMagicNumber, MN,.....
https://docs.mql4.com/basis/preprosessor/constant
You only need to find your Orders which are was opened with this Magic Number ... if (OrderMagicNumber()==myMagicNumber) do Something ...
Thank you
but then, in my modest opinion, it would have been better to call this variable OrderNumber.. less confusing.
Thank you
but then, in my modest opinion, it would have been better to call this variable OrderNumber.. less confusing.
welcome :-)
like this is defined in Ordersend:
magic | - | Order magic number. May be used as user defined identifier. |
OrderSend give you the brokers order number, that is what you need to modify orders.
MagicNumber is not used by the broker, it allows you to differentiate orders by this EA vs all other orders.
The following code will find any open orders on the current chart by the current EA, ignoring all others. OrderTicket() returns the order number for the modification.
for(int pos = OrdersTotal()-1; pos >= 0 ; pos--) if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() ){ // and symbol ... OrderModify(OrderTicket(), ...
#define MAGICMA 20050610
is not a good idea, as it doesn't allow the same EA to be placed on the same pair but two different time frames, and it doesn't allow changing the number incase of conflict with other EAs. Magic number should be an extern int.
Thank you
but then, in my modest opinion, it would have been better to call this variable OrderNumber.. less confusing.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
what does it means
#define MAGICMA 20050610
what kind of variable is MAGICMA ?? and why it is defined for value 20050610
I found this in the EA named Moviing Average