iCustom always returns same value "10 .0"

 

I am trying to create original EA with MQL5, but iCustom function returns always 10.0.

Code :

  double MA1 = iCustom("USDJPY",PERIOD_CURRENT,"Examples\\Custom Moving Average");

                 Alert(MA1);


If I delete Custom Moving Average.ex5,iCustom always returns value of -1.0.

so, Custom Moving Average.ex5 seems to be read correctly.

 
UJF2008:

I am trying to create original EA with MQL5, but iCustom function returns always 10.0.

Code :

  double MA1 = iCustom("USDJPY",PERIOD_CURRENT,"Examples\\Custom Moving Average");

                 Alert(MA1);


If I delete Custom Moving Average.ex5,iCustom always returns value of -1.0.

so, Custom Moving Average.ex5 seems to be read correctly.

iCustom uses an integer and returns the handle for processing not an indicator value, have a look here

https://www.mql5.com/en/docs/indicators/icustom


regards

Documentation on MQL5: Technical Indicators / iCustom
Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
[in]  The name of the custom indicator, with path relative to the root directory of indicators (MQL5/Indicators/). If an indicator is located in a subdirectory, for example, in MQL5/Indicators/ [in] input-parameters of a custom indicator, separated by commas. Type and order of parameters must match. If there is no parameters specified, then...
 
UJF2008 :

I am trying to create original EA with MQL5, but iCustom function returns always 10.0.

Code :

  double MA1 = iCustom("USDJPY",PERIOD_CURRENT,"Examples\\Custom Moving Average");

                 Alert(MA1);


If I delete Custom Moving Average.ex5,iCustom always returns value of -1.0.

so, Custom Moving Average.ex5 seems to be read correctly.

In MQL5, the indicator handle must be CREATED ONCE (in OnInit), and then (to obtain data) use CopyBuffer.

Example: iCustom

Documentation on MQL5: Technical Indicators / iCustom
Documentation on MQL5: Technical Indicators / iCustom
  • www.mql5.com
[in]  The name of the custom indicator, with path relative to the root directory of indicators (MQL5/Indicators/). If an indicator is located in a subdirectory, for example, in MQL5/Indicators/ [in] input-parameters of a custom indicator, separated by commas. Type and order of parameters must match. If there is no parameters specified, then...
 
Vladimir Karputov:

In MQL5, the indicator handle must be CREATED ONCE (in OnInit), and then (to obtain data) use CopyBuffer.

Example: iCustom


Thanks to Vladimir Karputov and Paul Anscombe, I've resovled this problem.

Thank you very much!!

Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...