how to set the indicator's input parameter from an Expert Adviser

 

I calling an indicator in my EA using iCustom, and the indicator has an input parameter. How can back-test the EA using different input values of the indicator's input parameter...

Of course I can set a default value and compile the indicator with different default input values. But, I don't want recompile it every time.

Please let me know what is the right way to do this. 


Thank you,

 
mikeitexpert:

I calling an indicator in my EA using iCustom, and the indicator has an input parameter. How can back-test the EA using different input values of the indicator's input parameter...

Of course I can set a default value and compile the indicator with different default input values. But, I don't want recompile it every time.

Please let me know what is the right way to do this. 


Thank you,

int  iCustom( 
   string           symbol,     // symbol name 
   ENUM_TIMEFRAMES  period,     // period 
   string           name        // folder/custom_indicator_name 
   ...                          // list of indicator input parameters 
   );
https://www.mql5.com/en/docs/indicators/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...
 


Thank you so much ... Big like

 
We can all use search here. It would be much more helpful if you posted an actual example
 

@hermestrading Here's an example of how a call to iCustom might be structured:

int myHandle = iCustom(_Symbol, _Period, "::Indicators\\<path\\to\\custom\\indicator>", [param_1, param_2,...param_n]);

- replace "<path\\to\\custom\\indicator>" with the correct path to your indicator.
- fill in the needed parameters at the end, after the path name. Separate multiple parameters with ', ' (comma).

Of course, this need to be in the appropriate event handler method, typically in OnInit().
Keep in mind this point from the iCustom docs (see @Philipp Negreshniy's link above:

[in] input-parameters of a custom indicator, separated by commas. Type and order of parameters must match. If there is no parameters specified, then default values will be used.
Documentation on MQL5: Language Basics / Variables / Input Variables
Documentation on MQL5: Language Basics / Variables / Input Variables
  • www.mql5.com
The input storage class defines the external variable. The input modifier is indicated before the data type. A variable with the input modifier...
 
Kyle Young Sangster #: - replace "<path\\to\\custom\\indicator>" with the correct path to your indicator.
And remove the brackets to pass the actual parameters.