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
Thank you. I confirm the issues, though I don't know if they are bugs or limitations of the Tester.
I reported that to MetaQuotes, we will see.
Thank you. I confirm the issues, though I don't know if they are bugs or limitations of the Tester.
I reported that to MetaQuotes, we will see.
It looks like the same bug:
Форум по трейдингу, автоматическим торговым системам и тестированию торговых стратегий
Робот создает много индикаторов при переключении таймфреймов.
Stanislav Korotky, 2025.12.27 18:39
I dug into the problem. I'm attaching the slightly modified source files. The logs are included, as is the solution.
Warning! There is a terminal bug.
A rough guide is this: If there are no ticks (they arrive rarely) or the timeframe switches very quickly (before the next tick arrives), the terminal DOESN'T Rush to OnInit the indicator being created . The only thing that can make it work—and this is the solution —is a dummy call to CopyBuffer immediately after receiving the handle in the Expert Advisor.
This solution has one downside: the indicator subwindow appears with a noticeable delay. Decide for yourself what's more important.
Now, specifically—a BUG. If you switch the timeframe between when you request the indicator's creation and its OnInit (meaning it's not yet completed, or even started, due to "slowness"), the subsequent initialization occurs for the new timeframe WITHOUT checking whether a copy of the same indicator with the exact same parameters and the new timeframe already exists (a cached copy, which remains in the terminal as a calculation component, just in case, until the indicator's idle timeout expires). Most likely, this check is performed in the terminal before the OnInit call, but it occurs for the old timeframe. When a tick arrives and the chart timeframe has already changed, OnInit is called for the new timeframe. The result is either duplicate, completely identical turkeys (if a tick has arrived) or one of the instances remains hanging uninitialized (if we change the TF before the tick), that is, it has not yet set the required shortname for itself.
In the logs, look for contextual comments after the double slash.
In the expert, define the SHOW_ME_BUG macro to see the problem.
Essentially - until one OnInit is not completed, the next OnInit (running in parallel, nested one) does not check indicator parameters for uniqueness.
It looks like the same bug:
Essentially - until one OnInit is not completed, the next OnInit (running in parallel, nested one) does not check indicator parameters for uniqueness.
The issue you are talking about was duplicate indicators when using ChartIndicatorAdd() on a live chart. (And I processed and reported it to MQ).
The issues here are about the Tester and an indicator NOT displayed at all, even when using ChartIndicatorAdd().
The issue you are talking about was duplicate indicators when using ChartIndicatorAdd() on a live chart. (And I processed and reported it to MQ).
The issues here are about the Tester and an indicator NOT displayed at all, even when using ChartIndicatorAdd().
I don't think you got it correctly. Please, review these posts:
Testing EA in Strategy Tester, you can see double logs from B, i suppose two instances of B was created, and it should not happen.
Hi Alain, with this code i have the same issue on terminal chart too, not only Tester. You not?
So the issue is that 2 instances of the indicator are created with the same parameters.
It's very similar to the linked bug.
I don't think you got it correctly. Please, review these posts:
So the issue is that 2 instances of the indicator are created with the same parameters.
It's very similar to the linked bug.
Thanks for trying to help.
This is not the same issue.
The issues here are about the Tester and an indicator NOT displayed at all, even when using ChartIndicatorAdd().
All bugs have been identified and reported.
It brings absolutely nothing to say "oh that's the same bug as there", except now I have to invest my time to explain.
In your case there are 3 issues :
1. The Tester doesn't automatically display an indicator called from an imbricated iCustom.
2. In the Tester, ChartIndicatorAdd doesn't work in an imbricated custom call.
3. In the Tester, duplicate indicators are launched if called from the EA iCustom and an imbricated indicator iCustom.
The issue Stanislav talked about is with ChartIndicatorDelete.
All bugs have been identified and reported.
It brings absolutely nothing to say "oh that's the same bug as there", except now I have to invest my time to explain.
In your case there are 3 issues :
1. The Tester doesn't automatically display an indicator called from an imbricated iCustom.
2. In the Tester, ChartIndicatorAdd doesn't work in an imbricated custom call.
3. In the Tester, duplicate indicators are launched if called from the EA iCustom and an imbricated indicator iCustom.
The issue Stanislav talked about is with ChartIndicatorDelete.
Everything is correct except point 3. It also occurs on Terminal charts, not only Tester. Tested with MT5 build 5640.
Everything is correct except point 3. It also occurs on Terminal charts, not only Tester. Tested with MT5 build 5640.
Have you tried putting your calls to indicator handles inside OnCalculate(), conditionally, as suggested by Airton Gomes Finoti in the other thread that you found?
"My work-around way is that EA load indicator A and indicator B in OnInit() process. Indicator A searches the handle of indicator B in the event of OnCalcute() for the first time. it shouldn't be done in the event of OnInit(). This work-around works well" (https://www.mql5.com/en/forum/98373#comment_18353294).