Price

[[price]] exposes a price series for a given symbol and timeframe, which can be different from those defined in [backtest].

Use it to feed other indicators or conditional blocks with prices coming from a specific market or timeframe.

Block declaration

A strategy can contain multiple [[price]] blocks. Each block outputs one series containing the chosen price.

Examples

Dedicated source, symbol, and timeframe

This block exposes a price series outside the main context. Here, it reads hlc3 on BINANCE:ETHUSDT on the daily timeframe. See the Exchanges, Symbols and Timeframes page for alignment rules with the main context.

[[price]]
id        = "eth_price"
symbol    = "BINANCE:ETHUSDT"
timeframe = "D"
source    = "hlc3"

Parameters

ParameterDescription
id
 String
 Required
Unique series identifier.
source
 String
 or Array
 Optional
Price source: "open", "close", "high", "low", "hl2", "hlc3", "ohlc4", "hlcc4", "volume".
Default value: "close"
symbol
 String
 or Array
 Optional
Market symbol from which this block reads the selected price source (open, close, high, low, hl2, hlc3, ohlc4, hlcc4, volume). If omitted, the block inherits the [backtest] symbol. For symbol format, arrays, and alignment rules, see Exchanges, Symbols and Timeframes.
timeframe
 String
 or Array
 Optional
Timeframe of the candles from which this price series is read.
If timeframe is omitted, the series is read on 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 price block exposes one numeric series representing the selected price source, together with the source name, symbol, and timeframe.

Assume the block is configured as:

[[price]]
id = "price"

Then:

VariableDescription
price or price[0]
Decimal
Current price value.
price[n]
Decimal
Price value from n candles ago.
price.source
String
Source used (open, close, high, low, hl2, hlc3, ohlc4, hlcc4, or volume).
price.symbol
String
Market pair used.
price.timeframe
String
Timeframe used.

Notes

  • Numeric variables support arithmetic, comparisons, and logical operators.
  • Text variables are strings intended for equality/inequality checks only.