- iAC
- iAD
- iADX
- iADXWilder
- iAlligator
- iAMA
- iAO
- iATR
- iBearsPower
- iBands
- iBullsPower
- iCCI
- iChaikin
- iCustom
- iDEMA
- iDeMarker
- iEnvelopes
- iForce
- iFractals
- iFrAMA
- iGator
- iIchimoku
- iBWMFI
- iMomentum
- iMFI
- iMA
- iOsMA
- iMACD
- iOBV
- iSAR
- iRSI
- iRVI
- iStdDev
- iStochastic
- iTEMA
- iTriX
- iWPR
- iVIDyA
- iVolumes
iCustom
The function returns the handle of a specified custom indicator.
int iCustom(
|
Parameters
symbol
[in] The symbol name of the security, the data of which should be used to calculate the indicator. The NULL value means the current symbol.
period
[in] The value of the period can be one of the ENUM_TIMEFRAMES values, 0 means the current timeframe.
name
[in] Custom indicator name. If the name starts with the reverse slash '\', the EX5 indicator file is searched for relative to the MQL5 root directory. So, for a call of iCustom(Symbol(), Period(), "\FirstIndicator"...), the indicator will be loaded as MQL5\FirstIndicator.ex5. If the file is not found at this path, error 4802 (ERR_INDICATOR_CANNOT_CREATE) is returned.
If the path does not start with '\', the indicator is searched and downloaded as follows:
- First, the indicator EX5 file is searched for in the folder where the EX5 file of the calling program is located. For example, the CrossMA.EX5 EA is located in MQL5\Experts\MyExperts and contains the iCustom call (Symbol(), Period(), "SecondIndicator"...). In this case, the indicator is searched for in MQL5\Experts\MyExperts\SecondIndicator.ex5.
- If the indicator is not found in the same directory, the search is performed relative to the MQL5\Indicators indicator root directory. In other words, the search for the MQL5\Indicators\SecondIndicator.ex5 file is performed. If the indicator is still not found, the function returns INVALID_HANDLE and the error 4802 (ERR_INDICATOR_CANNOT_CREATE) is triggered.
If the path to the indicator is set in the subdirectory (for example, MyIndicators\ThirdIndicator), the search is first performed in the calling program folder (the EA is located in MQL5\Experts\MyExperts) in MQL5\Experts\MyExperts\MyIndicators\ThirdIndicator.ex5. If unsuccessful, the search for the MQL5\Indicators\MyIndicators\ThirdIndicator.ex5 file is performed. Make sure to use the double reverse slash '\\' as a separator in the path, for example iCustom(Symbol(), Period(), "MyIndicators\\ThirdIndicator"...)
...
[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.
Return Value
Returns the handle of a specified technical indicator, in case of failure returns INVALID_HANDLE. The computer memory can be freed from an indicator that is no more utilized, using the IndicatorRelease() function, to which the indicator handle is passed.
Note
A custom indicator must be compiled (with extension EX5) and located in the directory MQL5/Indicators of the client terminal or its subdirectory.
Indicators that require testing are defined automatically from the call of the iCustom() function, if the corresponding parameter is set through a constant string. For all other cases (use of the IndicatorCreate() function or use of a non-constant string in the parameter that sets the indicator name) the property #property tester_indicator is required:
#property tester_indicator "indicator_name.ex5" |
If the first call form is used in the indicator, then at the custom indicator start you can additionally indicate data for calculation in its "Parameters" tab. If the "Apply to" parameter is not selected explicitly, the default calculation is based on the values of "Close" prices.
When you call a custom indicator from mql5-program, the Applied_Price parameter or a handle of another indicator should be passed last, after all input variables of the custom indicator.
See also
Program Properties, Timeseries and Indicators Access,IndicatorCreate(), IndicatorRelease()
Example:
#property indicator_separate_window
|