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
| Parameter | Description |
|---|---|
idString Required | Unique series identifier. |
sourceString or Array Optional | Price source: "open", "close", "high", "low", "hl2", "hlc3", "ohlc4", "hlcc4", "volume".Default value: "close" |
symbolString 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. |
timeframeString 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:
| Variable | Description |
|---|---|
price or price[0]Decimal | Current price value. |
price[n]Decimal | Price value from n candles ago. |
price.sourceString | Source used (open, close, high, low, hl2, hlc3, ohlc4, hlcc4, or volume). |
price.symbolString | Market pair used. |
price.timeframeString | Timeframe used. |
Notes
- Numeric variables support arithmetic, comparisons, and logical operators.
- Text variables are strings intended for equality/inequality checks only.