Here's a simple EA to sell 1 MNQ on 1 MT5 instance : Code: long magic_number=12345; #include <Trade\Trade.mqh> CTrade m_trade; // trading object int OnInit() { m_trade.SetExpertMagicNumber(magic_number); m_trade.Sell(1,"MNQZ23",0,0,0); return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { } void OnTick() { } Once this is done, fire up another EA on the second instance to buy 1 MNQ by replacing "m_trade.Sell(1,"MNQZ23",0,0,0);" with "m_trade.Buy"l(1,"MNQZ23",0,0,0);". Compile both beforehand in the MQL5 editor. If you want to go the manual route, remember that all manual trades have magic number of 0.
I mean if manual trades have magic number 0, one sell would close the other buy. In this case, that's not what really happned. One closed early, and the other didn't. I think I might go insane over this...
I'm out of my knowledge area since I know NOTHING about MT5 or it's language,but I am an experienced coder. 2 things hit me right off... 1) MNQ is quoted in quarter increments. magic_number as a long DEmotes the actual MNQ quote, and loses all decimal places. Any comparison that takes place internally would be affected, as well as B/A spreads that straddle handles. 2) the OnInit event returns the success/fail of the event, BUT m_trade.Sell(1,"MNQZ23",0,0,0) MAY be throwing or returning a trade success/fail that is not being dealt with at all. The computer was born to solve problems that did not exist before ~~ Bill Gates
1) The magic number is an integer data type associated with and identifying a particular order and has nothing to do with the actual price quotes. 2) The simple EA's are just to open a trade in one MT5 instance and to see if it's possible to close it in a 2nd MT5 instance using the same magic number. This can be done manually as well. It therefore didn't warrant any error handling in my opinion. Good points, nonetheless.
Magic number is for identify orders from different EA. I guess if you use two separate instances you don't need different magics because the order history is local.. but maybe I'm wrong, never try use two instances with same broker account and same EA
As I've said, keeping yesterday's outlier out. It SHOULD'VE been a normal b/e day. This is what the real account looks like. There were 2 positive outliers I didn't include in this performance.
I did some speed/ping test of my vps and found some inconsistencies in the speed (under 100mb/s. I actually think it's the vps that's screwing things up. My other vps is consistenly faster (+150mb/s) and it's the same package. I'm using forexvps.net If you are using a different service, let me know and i'll try it out.