- MetaQuotes-Demo build 6182: Python timestamps appear 3 hours ahead of UTC
- MT5 backtester not loading data for backtests
- Testing CGraphic - questions and suggestions
Nobody will investigate such "report".
No code. No log. Nothing. I didn't even read all this text.
Forum on trading, automated trading systems and testing trading strategies
ChartSymbol() function return error 4102 in build 4231
AIRAT SAFIN, 2024.03.11 11:42
Inserting delay <for example 1000-2000 milliseconds> inside this hard loop has a chance that then everything will be fine
Thank you. I have prepared a small synthetic code package and the complete two-reader logs from one recorded failure.
EventSetMillisecondTimer(200) in RaceReadController.mq5 is likely insufficient.
Also:
Closing a file when you're finished working with it is an important rule to follow. This is due not only to the caching of the information being written, which may remain in RAM for some time and not saved to disk (as already mentioned above), if the file is not closed. In addition, an open file consumes some internal resource of the operating system, and we are not talking about disk space. The number of simultaneously open files is limited (maybe several hundred or thousands depending on Windows settings). If many programs keep a large number of files open, this limit may be reached and attempts to open new files will fail. (https://www.mql5.com/en/book/common/files/files_open_close).
Thank you. I have prepared a small synthetic code package and the complete two-reader logs from one recorded failure.
I checked all this stuff.
As I understand the code is similar to your real code but with some features removed ? I want to know if the real is doing similar things, as otherwise it's useless. Your provided capture_X.tsv looks different from what your code produces. Did you really get error 4102 with the code provided ?
round begin_relative_ms end_relative_ms value error
1 0 0 1 0
2 0 0 1 0
3 0 0 1 0
4 0 0 1 0
5 0 0 1 0
Using GetTickCount64() how could you get 0 ?
I don't have the error 4102. So the problem is not reproducible.
When you got error 4102 with a ~3 seconds delay to answer, that means the queue processing the chart is full. Why ? It depends of the real code used, I can't check further as I can't reproduce the problem.
"Your" way to use a 3 seconds loop to check GlobalVariable is NOT good. I can't say for sure this is the problem but it's certainly a problem.
I have now recorded error 4102 without the busy-poll barrier. The attached v2 uses paired custom-event callbacks: each reader does one ObjectGetInteger and returns. Once both acknowledge that round, the second finisher queues the next event using GlobalVariableSetOnCondition. No waiting loop or Sleep is used.
In your custom indicator file, you have:
int OnCalculate(const int total,const int prev,const datetime &time[],const double &open[],const double &high[],const double &low[],const double &close[],const long &tv[],const long &vol[],const int &spread[]){return total;}
(emphasis added).
I don't see total defined anywhere else in the indicator code.
There are 2 valid forms of OnCalculate(), both of which use rates_total: https://www.mql5.com/en/docs/event_handlers/oncalculate
On a more general note, I would probably embed all of the MQL5-side code into an MQL5 service which has MT5 terminal-wide access─instead of separate mq5 files. In this way, "source" chart(s) for an indicator nor an EA would be required.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use