Highest
[[highest]] returns, on each candle, the highest value observed over the last length bars of the selected series. You use it to track a recent upper bound, define a moving resistance, detect a breakout, or compare the current level with its highest recent extreme over a given period.
Unlike an average, Highest does not smooth the market and does not try to summarize price with a central value. It keeps the maximum of the current window, then changes only when a more recent high appears or when the previous maximum leaves the window. The result is a simple, stable reference that describes the upper limit of the recent move rather than an average trend.
The output depends entirely on the input series. Applied to high, the block tracks the highest value among recent candles. Applied to close or to the output of another indicator, it tracks the recent maximum of that series. That makes it useful for building a channel, expressing a breakout condition, or reusing a recent extreme in other strategy blocks.
Block declaration
A strategy can contain multiple [[highest]] blocks. Each block outputs one numeric series: the rolling maximum value.
Examples
Minimal setup
This block uses the implicit "high" source, so it tracks the highest value observed over the last 20 bars.
[[highest]]
id = "highest"
length = 20Custom source and finding the optimal length
This block explores a range of values for length on the close series to identify the best-performing length.
[[highest]]
id = "highest"
source = "close"
length.start = 10
length.stop = 30Parameters
| Parameter | Description |
|---|---|
idString Required | Unique identifier for the resulting series. |
sourceString or Array Optional | Input series used for the calculation. Accepted forms: source = "hl2" or source = ["close", "hl2"].Each value can be either a standard price source ( open, close, high, low, hl2, hlc3, ohlc4, hlcc4, volume) or the id of another indicator.Default value: "high" |
lengthInteger Required | Window size; must be ≥ 1. Usage: • Fixed: length = value• Grid search: – length.start = min_value– length.stop = max_value– length.step = value (optional, default 1) |
symbolString or Array Optional | Market symbol(s) used when source only consists of standard prices (open, close, high, low, hl2, hlc3, ohlc4, hlcc4, volume).If source mixes standard prices and indicator ids, symbol is applied only to combinations based on standard prices.If source contains only indicator ids, symbol is ignored.When omitted, the block inherits the [backtest] symbol.For symbol format, arrays, and alignment rules, see Exchanges, Symbols and Timeframes. |
timeframeString or Array Optional | Timeframe on which this indicator is computed. If timeframe is omitted, the computation uses the grid’s main timeframe defined in [backtest].For accepted formats and timeframe alignment rules, see Exchanges, Symbols and Timeframes. |
Available variables
Use the identifiers below directly in your expressions. The highest block exposes one numeric series and its parameters (length, source, symbol, timeframe).
Assume the block is configured as:
[[highest]]
id = "highest"
length = 20Then:
| Variable | Description |
|---|---|
highest or highest[0]Decimal | Current rolling maximum. First valid sample appears after length - 1 candles. |
highest[n]Decimal | Value n candles ago (e.g. highest[1] for the previous bar). |
highest.lengthDecimal | Effective window size used during the current combination. |
highest.sourceString | Actual source id (high, close, another indicator). |
highest.symbolString | Display name of the symbol feeding this block. |
highest.timeframeString | Timeframe used for the computation. |