Possible bug: symbols not getting deselected in tester causing memory usage to increase and tester to shut down
I am running into a problem when cycling through symbols which only happens when running in tester mode, i.e. this problem does not occur when running on live data. I am cycling through all available symbols in order to collect those with the same underlying (relevant to futures trading, however the error is reproduced when the attached script is run on any symbol).
When I run in live mode everything is fine, but when running in tester I get messages in the journal telling me that symbol info is being synchronised for every symbol, up to a point, and then I have a message saying "no more than 1000 symbols can be selected", after which the symbol info synchronisation fails for remaining symbols and the tester shuts down. The attached EA gives a minimum working example that replicates the error, and the log file as well as journal output is attached. From the print out I can see that the memory usage is also climbing as it cycles through the symbols, which does not happen in live.
I saw a post where it was recommended to use SymbolSelect(symbol, false) after any querying of symbol data to deselect it in the market watch, I have this in the script but it is not resolving the issue so I don't think it was actually relevant. I can't think of any reason why the symbols and their info data would be accumulating in the tester but not in live, so this seems to me to be a bug. Perhaps though there is something extra that has to be done to clear symbols/symbol info data from the terminal in tester mode that I'm not aware of, I have been searching these forums for a while now and have not found anything relating to this particular issue.
Many thanks in advance to anyone who may have some advice on what's happening here! I am running the latest MT5 on Windows 10 virtual machine (hosted within VirtualBox on a Mac) if that's relevant.
Hi Alain, thanks for the response. That was one of my first lines of investigation which led me to a forum post where another user was cycling through symbols like me. Their solution was putting the SymbolSelect(symbol, false) in the loop. However this has not worked for me and the fact that this only happens in the tester agent (debugging on historical data), and not when executing in live, makes me think something else might be happening. I also don't see any of those symbols actually appearing in the market watch window even if I omit the SymbolSelect(symbol, false).
Please read the documentation :
Prior to starting testing of a multi-currency Expert Advisor, it is necessary to select symbols required for testing in the "Market Watch" of the terminal and load the required data. During the first call of a "foreign" symbol, its history will be automatically synchronized between the testing agent and the client terminal. A "foreign" symbol is the symbol other than that on which testing is running. |
Referral to the data of an "other" symbol occurs in the following cases:
...
You are trying to do things (it's not clear what exactly) which are not possible due the documented limitations of the Strategy Tester.
![Documentation on MQL5: MQL5 programs / Testing Trading Strategies Documentation on MQL5: MQL5 programs / Testing Trading Strategies](https://c.mql5.com/36/46/documentation-on-mql5-mql5-programs.png)
- www.mql5.com
Thanks Alain. I read the documentation links you sent and I don't think this particular issue (why symbols cannot be deselected in the tester agent) is documented there, but I guess that's besides the point now. It looks as if symbol info sent to the tester agent will never be released even with SymbolSelect(symbol, false).
The reason for doing this in the first place was to identify all futures contracts relating to a particular underlying, so as to construct a futures curve. The only reliable way I could see of doing this was cycling through all contracts and checking certain info. Since this will fail in the tester agent, I think I will just have to get around it by keeping symbol info in a database and retrieving from that so that symbol info doesn't get unnecessarily synched and stored in the tester agent.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am running into a problem when cycling through symbols which only happens when running in tester mode, i.e. this problem does not occur when running on live data. I am cycling through all available symbols in order to collect those with the same underlying (relevant to futures trading, however the error is reproduced when the attached script is run on any symbol).
When I run in live mode everything is fine, but when running in tester I get messages in the journal telling me that symbol info is being synchronised for every symbol, up to a point, and then I have a message saying "no more than 1000 symbols can be selected", after which the symbol info synchronisation fails for remaining symbols and the tester shuts down. The attached EA gives a minimum working example that replicates the error, and the log file as well as journal output is attached. From the print out I can see that the memory usage is also climbing as it cycles through the symbols, which does not happen in live.
I saw a post where it was recommended to use SymbolSelect(symbol, false) after any querying of symbol data to deselect it in the market watch, I have this in the script but it is not resolving the issue so I don't think it was actually relevant. I can't think of any reason why the symbols and their info data would be accumulating in the tester but not in live, so this seems to me to be a bug. Perhaps though there is something extra that has to be done to clear symbols/symbol info data from the terminal in tester mode that I'm not aware of, I have been searching these forums for a while now and have not found anything relating to this particular issue.
Many thanks in advance to anyone who may have some advice on what's happening here! I am running the latest MT5 on Windows 10 virtual machine (hosted within VirtualBox on a Mac) if that's relevant.