You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Sergei!
That's what trade server return codes are for such situations.
Example: You checked the availability of free funds and received an affirmative result.
You send an order, but it was not accepted (as you said: "What can happen"),
so the trading server will give you the error "Insufficient funds" in the return code.
Mikhail, do you really think I don't understand this? :)
Ok, I'll translate my phrase and the thought of the article: first we do a preliminary check and then we check the result. I don't get hung up on trading (for it, yes, these are trade server return codes) as it could be anything:
1) For example a file: first check if such a file exists, if not, then create and write data to it. Afterwards, check what the result is
2) For example a graphical object: first check if such an object exists. If it doesn't, it was created, otherwise it was moved (if the coordinates have changed). Then we checked what we got.
etc. Almost anything that depends on something else and can fail.
So, let's still define/summarise. Your main complaint is that the codes of trading server error returns and possible program reactions to them are not considered?
On the first point - all this is in the documentation.
On the second point - it seems to me that if you read the article, the possible reactions will become obvious.
But if you don't agree with me, the easiest solution is to write a whole article about it. Personally, I don't think it's that necessary to write about it myself. If it is that important to you, then please do it. I am sure you will do better than me, because you have a clear interest in it.
P.S. I am sure that MQL4/5 is not only about Expert Advisors. Obviously, for you it is mostly them. But for example, for the last two months I have made twice as many indicators as EAs. So everything is very subjective.
Sergey!
I have no complaints about your article.
Hi,
thank you for your article!
Am I allowed to use your CLogger class in my own projects?
BTW: What kind of license do articles/source code from mql5.com belong to?
Best regards,
Alex
I use MT5.
When I used your example in the backtest, the "mylog" is written in the folder C:\Program Files\MetaTrader 5 Terminal\Tester\Agent-127.0.0.1-3000\MQL5\Files.
To make things easier, I thought I'd put it in a personal folder: "C:\\MT5Personal\\Logs\\mylog", for example.
However, I always get error 5002, and the size of the name doesn't exceed 255 bytes.
What could be wrong?
Thank you.
On the efficiency of the logger... The java language also first made a logger, and then had to suffer for a long time.
In java, this problem was solved by using var args, which are not available in MQL4/5. What is the problem ? - first we call error.toString() then concatenate all strings in `CLogger::log(string1 + string2 + string3...); ` and only at the end we check whether the obtained string should be printed.
What would I suggest instead? - Nothing new, what has actually become a standard in the same java:
`if(CLogger::isLevel(LOG_LEVEL_INFO))
CLogger::log(string1 + string2 + string3);`
of course in this case you need to have different loggers for logging to file, printf and others.
It's all tied up in one file only. What if you have to keep two? What if something only needs to be printed and something needs to be written to a file? No flexibility. It is necessary not to make a call through defyne, but through the creation of an object.
Or for example, I want to print and write to a file. Or I want to send a push and send an email at the same time.
What a treasure! Thank you for your contribution!
Cheers, Zarik