indicator is too slow

 

Hi.
I have my iCustom indicator. When I run my Expert include my indicator I got the message : "indicator is too slow, 3323 ms. rewrite the indicator, please"
What should I do to solve this problem

 

Thanks

Meir 

 
  1. Change it so it only calculates changed bars.
    int counted = IndicatorCounted();
    int lookback = ... // iMA(period) has look back of period.
                       // buffer[i+2] has look back of 2
                       // use maximum of all.
    for(int iBar = Bars - MathMax(lookback, counted); iBar >= 0; --iBar) ...
  2. Reduce max bars on chart
  3. change it do only calculate visible areas
 
Hello,

here the same problem. What I not understand is why there is such a message occur.
My indicator is a simple RSI thing which produce one signal. I tried 15 different pairs  to watch simultaneous. And in each chart I put in the indicator twice.
There is no problem, I never saw this message before.

But then, when I try to catch the signal with an EA with iCustom method with the same indicator and check if there is a signal only at the first tick in each bar, there is one hour nothing
and then suddenly each minute comes the message. Then awhile no message and then 10 in one minute.

So, what is going on in this EA with the iCustom. Is this any thread thing which can´t play together, or what is the problem in this thing?

Thank you
 
Frika: here the same problem. What I not understand is why there is such a message occur.
  1. How should we know? You haven't posted your indicator's code.
  2. See How to do your lookbacks correctly.
 
whroeder1:
  1. How should we know? You haven't posted your indicator's code.
  2. See How to do your lookbacks correctly.

I wish I could post the code of the indicator, but I´m not the owner so I have to ask first.

But what I not understood was the fact that the indicator runs in multiple way in a lot‌ of chars without any issue, but when I try to catch the function with the EA there is somewhere a eye of a needle‌

or‌ whatelse. That the handling is so different. I thought that the indicator is loading one time at the beginning of the initialization of the EA and run like it would loaded normaly in the chart, right?

 
Frika:

I wish I could post the code of the indicator, but I´m not the owner so I have to ask first.

But what I not understood was the fact that the indicator runs in multiple way in a lot‌ of chars without any issue, but when I try to catch the function with the EA there is somewhere a eye of a needle‌

or‌ whatelse. That the handling is so different. I thought that the indicator is loading one time at the beginning of the initialization of the EA and run like it would loaded normaly in the chart, right?

Check if the parameters passed to the indicator from iCustom() call are correct. Sometimes wrong parameters in iCustom() call can cause that issue
 
Mladen Rakic:
Check if the parameters passed to the indicator from iCustom() call are correct. Sometimes wrong parameters in iCustom() call can cause that issue
Tahnks for reply Mladen, but I think the parameters are ok so far. 
Signal = iCustom(NULL,0,indicatorName,0,current);

I had reduced the maxBars in the option Menu of MT4. In Chart and History to 2500. This was made the deal.

But the question still exist. Why do the indicator works without problems if its loaded normally in the chart (15 pairs smultanous) but bring up this error messages when ‌it is load by an EA.

 
Frika:
Tahnks for reply Mladen, but I think the parameters are ok so far. 
Signal = iCustom(NULL,0,indicatorName,0,current);

I had reduced the maxBars in the option Menu of MT4. In Chart and History to 2500. This was made the deal.

But the question still exist. Why do the indicator works without problems if its loaded normally in the chart (15 pairs smultanous) but bring up this error messages when ‌it is load by an EA.

 
To figure out where is a bottleneck you should use a profiler. Unfortunately, you can't use the built-in profiler in your case, because you think that slowdown happens only when the indicator is called via iCustom. As a workaround, you could probably try my profiler class. Embed it both into your EA (to measure iCustom invocation time) and the indicator (to measure some critical lines of code). Set UseGlobalVariables to true to accumulate both statistics in terminal's global varibales. Then you'll probably know which part runs slow.
 
Frika: I had reduced the maxBars in the option Menu of MT4. In Chart and History to 2500.
Why would you want to delete your history? Can't optimize any more.
Reason: