indicatorCreate and iCustom

 

Hi,


I'm wonder what is the difference between iCustom and IndicatorCreate functions which give a handle of home made indicator both.


In which condition shall I use one or other ?


Thanks !

Erwann.

 
I'm wonder what is the difference between iCustom and IndicatorCreate functions which give a handle of home made indicator both.

The description on this page answers your question.

https://www.mql5.com/en/docs/constants/indicatorconstants/enum_indicator

Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Indicator Types
Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Indicator Types
  • www.mql5.com
There are two ways to create an indicator handle for further accessing to its values. The first way is to directly specify a function name from the list of technical indicators. The second method using the IndicatorCreate() is to uniformly create a handle of any indicator by assigning an identifier from the ENUM_INDICATOR...
 
Erwann Pannerec:

Hi,


I'm wonder what is the difference between iCustom and IndicatorCreate functions which give a handle of home made indicator both.


In which condition shall I use one or other ?


Thanks !

Erwann.

IndicatorCreate() is only advantageous when you write generic code to manage indicators.
 

What Alain said, and to make it a little more precise:


IndicatorCreate is better suited when you want to set the number of parameters and their types and values at runtime (it's a dynamic option of creating indicators because it always uses the same MqlParam[] which encapsulates the actual parameters).

While iCustom has to state all parameters at the compilation time (which fixes their number and type, only the values can be changed at runtime) - which makes it less flexible when you want to call many different indicators with the same code.

 
Amir Yacoby:

What Alain said, and to make it a little more precise:


IndicatorCreate is better suited when you want to set the number of parameters and their types and values at runtime (it's a dynamic option of creating indicators because it always uses the same MqlParam[] which encapsulates the actual parameters).

While iCustom has to state all parameters at the compilation time (which fixes their number and type, only the values can be changed at runtime) - which makes it less flexible when you want to call many different indicators with the same code.

I thought people want quick answer so I write only 1 line
 
Alain Verleyen:
I thought people want quick answer so I write only 1 line
LOLL

You could connect some lines with ';' 
 
Amir Yacoby:
LOLL

You could connect some lines with ';' 

It's clear !


Many thanks for your help :)

Reason: