Median

Top  Previous  Next

Finds the median value of the series.The median is the middle value of the series if the series has an odd number of elements. If there are an even number of elements, the median is the average of the middle two values.

 

Syntax

 

Median( series, [bars], [offset] )

 

Parameters

series

 

the name of the series

bars

 

the number of bars over which to find the value. Default is the whole series.

offset

 

the number of bars to offset the starting index. Default is zero.

 

 

 

returns

 

the median

 

 

Example

' Find the median value of the last 100 bars of the series.

 

medianValue = Median( instrument.close, 100 )

 

 

This example shows the use of the common auto indexed series. For information on using functions with non auto indexed series review Series Functions.