Skip to main content

bars_since_highest

Syntax Format

The syntax format can be of two types:

bars_since_highest(series, n)
bars_since_highest(n)

Overview

The bars_since_highest function provides the number of bars since the highest value of the given series type was reached within a specified period. This function can be used in scripts, when checking the data after a certain event has occurred.

Parameters

ParameterTypePurpose
seriesseriesInput series, taken into calculation
nintegerPeriod to look back into the history

Returns: series[integer].

Example

bars_since_highest_value = bars_since_highest(close, 14)

In case the series type is not specified, the high series is used:

bars_since_highest(high, 14)