MT4 mixing up price feeds?

 
Hi was wondering if anyone ever encountered this problem.I had an EA made for me however when it puts a limit order to buy an fx it mixes up the prices.. so for example if EURUSD is at 1.5212 and EURCHF is at 1.4021, if I want to buy EURUSD the EA somehow mixes up the price and puts a limit order to buy at 1.4021... anyone ever seen anything like this? Any solutions?
 
alextn:
Hi was wondering if anyone ever encountered this problem.I had an EA made for me however when it puts a limit order to buy an fx it mixes up the prices.. so for example if EURUSD is at 1.5212 and EURCHF is at 1.4021, if I want to buy EURUSD the EA somehow mixes up the price and puts a limit order to buy at 1.4021... anyone ever seen anything like this? Any solutions?

It must be a bug with the code... It's safe to say that the MT4 platform is stable enough and does not have these kind of bugs. Show us the code...

 
alextn:
I had an EA made for me however when it puts a limit order to buy an fx it mixes up the prices.

No arguments with Gordon's statement But if you 'had it made for you', then you should be taking it back to the person or company that 'made it for you' and have them find the error in it and fix it.

 
gordon:

It must be a bug with the code... It's safe to say that the MT4 platform is stable enough and does not have these kind of bugs. Show us the code...

99.99% likely to be a bug in the MQL4 code, but I have seen a vaguely similar phenomenon in MT4 itself under heavy load: https://www.mql5.com/en/forum/115837

 
jjc:

99.99% likely to be a bug in the MQL4 code, but I have seen a vaguely similar phenomenon in MT4 itself under heavy load: https://www.mql5.com/en/forum/115837

That's news to me. I have done stress testing (on Demo's) with ~10 EA's on same Terminal and have never had problems like that. That post is pretty old though, these problems might have been solved already.

 
gordon:

That's news to me. I have done stress testing (on Demo's) with ~10 EA's on same Terminal and have never had problems like that. That post is pretty old though, these problems might have been solved already.

Might well have been fixed and, anyway, it was only happening under the sort of loads which you'd be mad to run through MT4 anyway. If you have a need to do hundreds (in fact, I think it was thousands) of orders per hour, then you almost certainly need a platform with asynchronous order placement...

EDIT: I might be wrong about that. Casting my mind back to over a year ago, I think that we very occasionally saw problems in live trading as well, on small order volumes. I could reliably replicate the problem using heavy loads, but we'd also get very occasional instances of it (e.g. once per week) in live trading on normal order volumes. All fixed by using the code in https://www.mql5.com/en/articles/1412.

 
Hi JJC,
So basically the problem was caused by orders that were very small?
I thought that it might be the code but I realized that this error only occurs every once in a while, which to me says that it should be MT4 and not my code?
I will post my code as soon as I get it.
 
alextn:
So basically the problem was caused by orders that were very small?

In my case the problem was caused - and was capable of being replicated on demand - by placing very large numbers of orders in a short period of time from multiple EAs (running on different symbols). The number of lots per order probably wasn't important, but I never investigated that.

alextn wrote >>
I thought that it might be the code but I realized that this error only occurs every once in a while, which to me says that it should be MT4 and not my code?

It depends. Are you ever placing orders for another symbol, i.e. different to the chart on which the EA is running? Are you ever reading the price for other symbols using functions such as iClose() and iHigh()? Are you only running a single copy of your EA, not multiple copies on charts for different symbols?

If the answer to any of those questions is yes, then I'd bet on the problem being in your code, not in MT4. If your EA definitely only ever looks at its own chart's symbol, then you may have hit the same sort of phenomenon that I saw. But your description sounds a bit different to what I saw. I'm still betting that the problem is in your code, not in MT4.

EDIT: ...possible special case if you're trading through a broker such as FXCM who use the Boston Technologies bridge. I wouldn't trust the BT bridge to give me the correct time of day. Particularly when dealing with pending orders; it's really bad at those.

Reason: