Whick block can give MQL error codes?
-
My recent EA works smoothly in 3 out of 4 times. For a reason I can't understand, some trades are not opened and I have no idea why. If code was wrong no one would be opened. I need to discard broker problems and this is why I need a block telling me why an order is not opened. Could someone please tell me which block can specify the error number for a failed trade?
Thank you very much in advance.
-
What error messages do you see in the logs in MetaTrader?
-
That's the problem. No errors are shown. All conditions are met but no order is launched in one out of 4 trades. I have no idea why and I guess it can be a broker's server problem. Is there any way to confirm it using fxdreema?
-
Make sure that you are not working under "on Init"
When you don't know whether a block passes or not, put "Draw Arrow" after it and if you don't see any arrows on the chart, then the block does not pass. There is actually block "Trace Activity" for this purpose, but I personally mostly use "Draw Arrow"
Anyway, any block that prints something somewhere can be used.Otherwise when you run "Buy now", it should make a trade. If you are sure that this block runs and you don't have a trade as a result, then something is wrong. But I can't imagine running this block, not having any trade and not having any error message. If this is the case, are you sure you are running the right EA?
-
Before doing that I want to be sure I understood your suggestion about looking at the logs. I created this easy EA:
https://fxdreema.com/shared/dOCTWLPUd
As you can see, I can specify the sop loss manually. This way I can open a trade with an incorrect SL price so that an Error 130 message should appear at the logs. Well, it simply doesn't happen. I'm still learning how MT4 works so I'm not sure if this is the way to know the error number of a failed trade. Could you please confirm this is the way to do it?
-
For this particular example I can see that Virtual Stops are enabled, which means that you have horizontal lines instead of hard stops. By default this option is not enabled.
People who use fxDreema would report to me so many errors if their EAs suddenly starts producing errors. So, for many processes, if something is not quite right, it will still work somehow. For example, whatever value you put for lot size - too small or too big - the EA will calculate the nearest possible value and will take it instead.
-
Interesting. I will follow your suggestion and will report what I get. Thank you.
-
Well, I finally found the origin of all my problems with this EA: Offquotes. All failed trades are caused by an Offquotes/Requotes problem. For some unexplainable reason, one out of four trades can never be traded because of that problem. I can see at the experts tab how the EA tried to open it up to 10 times, but for no avail. I read in another thread that Fxdreema doesn't use Refreshrates orders because of how it is designed, and this is the traditional solution for Offquotes. So how can I fix it here?

-
Refreshrates orders?
-
Sorry, I'm still improving my English.
What I mean is what is said on this thread in a different forum.Could you please help me to do that?
-
Well, I don't use OrderSend() or OrderModify() directly. There is a big function that does some checks before and after trading. In case of failure, the EA should try again few more times (10 in total) and then will fail, which means that the gray output of the block will be active. But there are recoverable errors and fatal errors. In case of fatal error, there will be no retries. ERR_OFF_QUOTES is from the recoverable errors, so it will try 10 times with 1 second delay between each attempt.
-
Yes, that's exactly my case. I can see that after 10 retries, it stops. In effect all my errors are ERR_OFF_QUOTES. Is there a way to increase the number of retries? Or could you suggest me any other way to avoid ERR_OFF_QUOTES errors?
-
You can connect the gray output with the input, but is this a good idea... Why do you have so many off quotes?
-
I'm sorry. I don't understand what you mean. I'm talking about this EA:
https://fxdreema.com/shared/tYQleFAb
And I have no idea why I have so many offquotes. I tested up to three different brokers and the result is always the same.

-
I put this EA in my demo, but who knows when will I see trades and errors. Do you have some logs?
-
No problem. I send the to you via private mail.
-
I have MetaTrader here running with this EA for a while and I didn't noticed problems. I was also switching my PC on and off (Sleep actually, not restart) and here is what I got: http://prntscr.com/cxkywn
-
Just curious. What broker did you use?
-
MetaQuotes Demo, I guess. I have one main MetaTrader installation for experiments and I have few demo accounts in different brokers there
