Median

Median ( int length );

Default values:

length: 12

Description

Returns the median value of data for the last length bars. Median value is equal to the middle element of ascendingly sorted data set if the number of elements is odd; if the number of elements is even, median value is equal to the average between the two middle elements of ascendingly sorted data set.

Input parameters

Parameter Default value Description
data - Defines data for which the median value is found.
length 12 Defines period on which the median value is found.

Example

input length = 15;
plot med = Median(high, length);

This example script plots a median High price among the last 15 bars.