MQL4 - automated forex trading   /  

Forum

Magic number

Back to topics list To post a new topic, please log in or register

avatar
13
jmarch 2008.04.09 21:43 

Magic number.

Can you have same EA running on two different markets, which opens trades at exact same time, according to the strategy, as long as different magic number is used for each chart?

article

Interaction between MetaTrader 4 and Matlab via CSV Files

Step-by-step instructions of how to organize data arrays exchange between MetaTrader 4 and Matlab via CSV files.


avatar
396
ukt 2008.04.10 14:23 

exact same time? no, because only one trading operation can be processed at any one time ie, is one trading thread only, so exact same time is not possible

if by markets you mean symbol pairs, EA can issue trade operations on any supported symbol pair.


magic number is user defined value meaning is totally up to you what value [if any] you use...


unique magic numbers should be used for every order but some may not do this and some may not use any magic number at all. same magic number on n orders is not invalid, magic number is for all purposes warranted to be same no matter what you do to the order (unlike orderComment which can be altered by system) - am talking OrderModify(ticket.A) which [as far as I have discovered], if successful, will actually close ticket.A order and open a new order containing modify values and assign new ticket.B to this opened order........ BUT you do not have this NEW ticket.B - only [hopefully used] unique magic number.


(let us hope that next system/language/whatever, upgrade allows OrderModify() to return ticket.B - in same manner as OrderSend() returns ticket.n )


This is why should use unique magic numbers because the only way you can [currently] map/reference the modified order in trade pool is by searching pool looking for this unique magic number.

some refs:

MagicNumber: "Magic" Identifier of the Order

Order ticket#

http://forum.mql4.com/10943

Select By Magic Number ?


Regards


Back to topics list  

To add comments, please log in or register