What is the best way to use iCustom?

 

Hi to All,

i need to call the same custom indicator (superTrend) more time in my EA, for current bar, and for historical bars.

After backtest, in the chart, there are to much superTrend indicators, it seems one indicator for one iCustom calls and  noticed a slow performance by MT4.

There is a best way to use iCustom?

thanks, 

Leo

 
eugleo76: After backtest, in the chart, there are to much superTrend indicators, it seems one indicator for one iCustom calls and  noticed a slow performance by MT4.
There is one, only one, for each unique parameter combination. Fix your iCustom calls.
 
William Roeder #: There is one, only one, for each unique parameter combination. Fix your iCustom calls.

Here how I call iCustom every time I need

double newSL = iCustom(Symbol(),PERIOD_CURRENT,ST_NAME,ST1_PERIOD,ST1_MULTIPLIE,ST1_SHOW_PRICE,ST1_SIZE_PRICE,false,false,false,1,1);

Is there a way to call iCustom one time?

If i put indicator on chart is it possible to read value from chart and not use iCustom?

Improperly formatted code edited by moderator. Please use the CODE button (Alt-S) when inserting code.

Code button in editor

 

As William already said, the indicator loaded is only 1 if your parameters are always the same.

Honestly I never seen a situation like yours in more than 5 years of coding mql.

The fact you see a lot of indicators means that you are calling iCustom with different parameters every time.


PS. No, you can't read values from indicators attached on chart, you need to use iCustom.

 
eugleo76 #: Here how I call iCustom every time I need
double newSL = iCustom(Symbol(),PERIOD_CURRENT,ST_NAME,ST1_PERIOD,ST1_MULTIPLIE,ST1_SHOW_PRICE,ST1_SIZE_PRICE,false,false,false,1,1);
  1. If that is true, then some indicator is calling it, or it is calling itself.
  2. With out seeing code we can only guess.
 
eugleo76 #:
Here how I call iCustom every time I need

Post a screenshot of the indicator parameters window. 90% chance that you missed some parameter or passed the parameters in the wrong order.

eugleo76:
After backtest, in the chart, there are to much superTrend indicators

I once had a similar situation when I accidentally missed one indicator parameter. A single call to iCustom was spawning hundreds of instances of the indicator on the chart just because I missed one parameter.