Skip to main content

per_bar_variables

Function per_bar_variables 

Source
pub fn per_bar_variables<O: PineOutput>(
    bar: &Bar,
    last_bar: Option<&Bar>,
) -> Vec<(String, Value<O>)>
Expand description

Every built-in variable a Bar sets: the price series (OHLCV and its standard derivations) as history-carrying Value::Series, bar_index as a plain number, then the per-bar namespaces from register_per_bar.

The single source of truth for these names and formulas, shared by execution and the sema symbol table. The value’s kind says how to store it: a Value::Series is one the interpreter should advance to accumulate lookback (close[1]); everything else is a plain assignment. Sema, needing only the names to resolve, registers them as-is.