Skip to main content

median

Syntax Format

median(series, period)

Overview

The median function provides the median value for the given series type over a certain period. This function is usually used in the scripts, where data smoothing is performed to reduce the noise and highlight more prominent price movements. You can also use this function as a standalone indicator, showing the median value of the series over a certain timeframe.

To receive the same data, you can use the percentile_nearest_rank function as well:

percentile_nearest_rank (series, period, 50)

Parameters

ParameterTypePurpose
seriesseriesInput value, taken into calculation
periodintegerInput period, taken into calculation

Returns: series.

Example

median_data = median(high, 14)