Skip to content

request

Functions

security

pine
request.security(
    simple string symbol,
    simple string timeframe,
    instructions<T> expression,
    simple string gaps = barmerge.gaps_off,
    simple string lookahead = barmerge.lookahead_off,
    simple bool ignore_invalid_symbol = false,
    simple string currency = na,
    simple int calc_bars_count = na
  ) → series T

Requests data from another symbol and/or timeframe.

Evaluates the expression argument using bars from the specified symbol and timeframe and returns the result as a series on the current chart.

Parameters

NameTypeDefaultDescription
symbolsimple stringThe symbol to request data for.
timeframesimple stringThe timeframe string (e.g. "D", "60", "W").
expressioninstructions<T>The expression to evaluate against the requested data.
gapssimple stringbarmerge.gaps_offGap-fill strategy. Use barmerge.gaps_off (default) to fill gaps with the previous value, or barmerge.gaps_on to keep gaps as na.
lookaheadsimple stringbarmerge.lookahead_offLookahead mode. Use barmerge.lookahead_off (default) to avoid lookahead bias, or barmerge.lookahead_on to allow it.
ignore_invalid_symbolsimple boolfalseIf true, returns na for unknown symbols instead of raising an error.
currencysimple stringnaOptional currency for price conversions.
calc_bars_countsimple intnaOptional maximum number of historical bars to calculate.

Returns: series T


security_lower_tf

pine
request.security_lower_tf(
    simple string symbol,
    simple string timeframe,
    instructions<T> expression,
    simple bool ignore_invalid_symbol = false,
    simple string currency = na,
    simple bool ignore_invalid_timeframe = false,
    simple int calc_bars_count = na
  ) → series array<T>

Requests data from a lower timeframe, returning an array of values — one element per lower-timeframe bar within the current chart bar.

Parameters

NameTypeDefaultDescription
symbolsimple stringThe symbol to request data for.
timeframesimple stringThe timeframe string (e.g. "1", "5"). Must be lower than or equal to the chart timeframe.
expressioninstructions<T>The expression to evaluate for each lower-TF bar.
ignore_invalid_symbolsimple boolfalseIf true, returns na for unknown symbols instead of raising an error.
currencysimple stringnaOptional currency for price conversions.
ignore_invalid_timeframesimple boolfalseIf true, returns na when the requested timeframe is not lower than the chart timeframe instead of raising an error.
calc_bars_countsimple intnaOptional maximum number of historical bars to calculate.

Returns: series array<T>

基于 MIT 许可证发布。