Quartile (Function)
The Quartile function returns the price value at the specified percentile.
Syntax
Quartile(QRank, Price, Length)
Returns (Double)
A numeric value containing the quartile price at the specified ranking level. The function returns -1 if QRank is less than 0 or greater than 4.
Parameters
Name |
Type |
Description |
QRank |
Numeric |
Sets the percentile ranking level. Enter 0 for 0%, 1 for 25%, 2 for 50%, 3 for 75%, or 4 for 100%. |
Price |
Numeric |
Specifies which bar value (price, function, or formula) to be considered. |
Length |
Numeric |
Sets the number of bars to be considered. |
Remarks
Quartile is a measure of "non-central" location used to split ordered data into four quarters.
The four quartiles can be defined as follow:
Q1: a value such that 25% of the observations are smaller, and 75% of the observations are larger.
Q2: a value such that 50% of the observations are smaller, and 50% of the observations are larger.
Q3: a value such that 75% of the observations are smaller, and 25% of the observations are larger.
Q4: a value such that 100% of the observations are smaller, and none of the observations are larger.
Example
Assigns to Value1 the first quartile value at 25% of the observations are smaller, and 75% of the observations are larger, based on the ordered Highs from the last 20 bars:
Value1 = Quartile(1, High, 20);
Assigns to Value2 the third quartile value at which 75% of the observations are smaller and 25% of the observations are larger, based on the ordered Closes from the last 10 bars:
Value2 = Quartile(3, Close, 10);