- Indexing Direction in Arrays, Buffers and Timeseries
- Organizing Data Access
- SeriesInfoInteger
- Bars
- BarsCalculated
- IndicatorCreate
- IndicatorParameters
- IndicatorRelease
- CopyBuffer
- CopyRates
- CopySeries
- CopyTime
- CopyOpen
- CopyHigh
- CopyLow
- CopyClose
- CopyTickVolume
- CopyRealVolume
- CopySpread
- CopyTicks
- CopyTicksRange
- iBars
- iBarShift
- iClose
- iHigh
- iHighest
- iLow
- iLowest
- iOpen
- iTime
- iTickVolume
- iRealVolume
- iVolume
- iSpread
IndicatorCreate
The function returns the handle of a specified technical indicator created based on the array of parameters of MqlParam type.
int IndicatorCreate(
|
Parameters
symbol
[in] Name of a symbol, on data of which the indicator is calculated. NULL means the current symbol.
period
[in] The value of the timeframe can be one of values of the ENUM_TIMEFRAMES enumeration, 0 means the current timeframe.
indicator_type
[in] Indicator type, can be one of values of the ENUM_INDICATOR enumeration.
parameters_cnt
[in] The number of parameters passed in the parameters_array[] array. The array elements have a special structure type MqlParam. By default, zero - parameters are not passed. If you specify a non-zero number of parameters, the parameter parameters_array is obligatory. You can pass no more than 64 parameters.
parameters_array[]=NULL
[in] An array of MqlParam type, whose elements contain the type and value of each input parameter of a technical indicator.
Return Value
Returns the handle of a specified technical indicator, in case of failure returns INVALID_HANDLE.
Note
If the indicator handle of IND_CUSTOM type is created, the type field of the first element of the array of input parameters parameters_array must have the TYPE_STRING value of the ENUM_DATATYPE enumeration, and the string_value field of the first element must contain the name of the custom indicator. The custom indicator must be compiled (file with EX5 extension) and located in the directory MQL5/Indicators of the client terminal or in a 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 form of the call is used in a custom indicator, you can additionally indicate as the last parameter on what data it will be calculated when passing input parameters. If the "Apply to" parameter is not specified explicitly, the default calculation is based on the PRICE_CLOSE values.
Example:
void OnStart()
|