|
Price Constants
Calculations of technical indicators require price values and/or values of volumes, on which calculations will be performed. There are 7 predefined identifiers from the ENUM_APPLIED_PRICE enumeration, used to specify the desired price base for calculations.
ID |
Description |
---|---|
PRICE_CLOSE |
Close price |
PRICE_OPEN |
Open price |
PRICE_HIGH |
The maximum price for the period |
PRICE_LOW |
The minimum price for the period |
PRICE_MEDIAN |
Median price, (high + low)/2 |
PRICE_TYPICAL |
Typical price, (high + low + close)/3 |
PRICE_WEIGHTED |
Average price, (high + low + close + close)/4 |
If the volume is used in calculations, it's necessary to specify one of the two values from the ENUM_APPLIED_VOLUME enumeration.
ID |
Description |
---|---|
VOLUME_TICK |
Tick volume |
VOLUME_REAL |
Trade volume |
The iStochastic() technical Indicator can be calculated in two ways using:
To select a necessary variant for calculation, specify one of the values of the ENUM_STO_PRICE enumeration.
ID |
Description |
---|---|
STO_LOWHIGH |
Calculation is based on Low/High prices |
STO_CLOSECLOSE |
Calculation is based on Close/Close prices |
If a technical indicator uses for calculations price data, type of which is set by ENUM_APPLIED_PRICE, then handle of any indicator (built in the terminal or written by a user) can be used as the input price series. In this case, values of the zero buffer of the indicator will be used for calculations. This makes it easy to build values of one indicator using values of another indicator. The handle of a custom indicator is created by calling the iCustom() function.
Example:
#property indicator_separate_window
|