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
To answer my own question: I have a partial solution. This solution works in case the log file already exists. Everywhere in the code where I currently use Alert() can I call this function.
What I don't know yet how to solve is:
(*) how to create a new log file if the log file doesn't exist yet?
(*) how to ensure that writing to file is only being done during paper/live trading, and not during back testing?
Well, printed outputs are saved in the tester log file during testing by default. Live trading log files are found in the terminal log file. File write is not supported in the tester btw.
You might try conditioning the Print() function with MQLInfoInteger to sort tester and live modes.
Well, printed outputs are saved in the tester log file during testing by default. Live trading log files are found in the terminal log file. File write is not supported in the tester btw.
You might try conditioning the Print() function with MQLInfoInteger to sort tester and live modes.
FileWrite is supported in the tester.
Well, printed outputs are saved in the tester log file during testing by default. Live trading log files are found in the terminal log file. File write is not supported in the tester btw.
You might try conditioning the Print() function with MQLInfoInteger to sort tester and live modes.
Well, printed outputs are saved in the tester log file during testing by default. Live trading log files are found in the terminal log file. File write is not supported in the tester btw.
You might try conditioning the Print() function with MQLInfoInteger to sort tester and live modes.
I discovered the same thing. I tried running a short backtest and noticed that no file operation was done. So I don't need code to detect whether I'm doing a backtest or doing paper/live trading.
Please do not post false information.
If no file operation was done then it is because of your code, not because FileWrite doesn't work in the tester.
It is more likely that you couldn't find where the file was stored. Search for the file using File Explorer.
Please do not post false information.
If no file operation was done then it is because of your code, not because FileWrite doesn't work in the tester.
It is more likely that you couldn't find where the file was stored. Search for the file using File Explorer.
The tone of your message is rather rash! Please be more careful.
I have done two tests: one is a backtest, and the other is forward testing. During forward testing is text written to the file. And yes, I am able to find the file, open it and read it! I also did a backtest, in Strategy Tester. No text was appended to the file, even though events did occur during the backtest which would normally have been written to file.
Please do not post false information.
If no file operation was done then it is because of your code, not because FileWrite doesn't work in the tester.
It is more likely that you couldn't find where the file was stored. Search for the file using File Explorer.
The tone of your message is rather rash! Please be more careful.
I have done two tests: one is a backtest, and the other is forward testing. During forward testing is text written to the file. And yes, I am able to find the file, open it and read it! I also did a backtest, in Strategy Tester. No text was appended to the file, even though events did occur during the backtest which would normally have been written to file.
I see nothing wrong with the tone of my post, whereas I do see something wrong with posting incorrect information.
Text will not be added to an existing file unless it is in the correct folder.
During the backtest, you will find that a new file with the same name was created in the tester file folder. Search for the file using File Explorer.
The file is opened in the folder of the client terminal in the subfolder MQL5\files (or testing_agent_directory\MQL5\files in case of testing).
The tone of your message is rather rash! Please be more careful.
I have done two tests: one is a backtest, and the other is forward testing. During forward testing is text written to the file. And yes, I am able to find the file, open it and read it! I also did a backtest, in Strategy Tester. No text was appended to the file, even though events did occur during the backtest which would normally have been written to file.
You have to understand experienced programmers are reading every day, a lot of assumptions like yours. "It's not possible, it's not working, must be an mql5 bug, or the bug in this library, etc...", all the possible reasons EXCEPT the own responsibility of the coder. And guess what, 99% of the time it IS a coder fault, bug or misunderstanding. The biggest one is NOT READ the documentation (or not correctly). Which is exactly your problem.
When you try to help people, it's a bit irritating to read always similar things and see the same behaviour. A good coder is humble, he knows there is a great chance it is his own work which lead to an issue. Bugs in mql4/mql5 or MT4/MT5 happens, but it's rare compared to the number of times are claiming something is not working or not possible.
Read the documentation again about how mql5 works with files with the Strategy Tester, I am sure you will find the answer and be proud of you
A bit of help :
Thank you for pointing me in the right direction. I have been able to find the directories (I ran multiple backtests in Strategy Tester) and did find text files there.
The conclusion is that I do need to include code in my EA to avoid creating these text files during backtesting as I don't want to "litter" my computer with these files.