Sidechair

ticker.inherit()

Browse the reference

Gives a symbol the settings of another ticker id: its session, adjustments and chart type.

Try it in the editor

ticker.inherit(from_tickerid, symbol) returns an id for symbol that carries the same modifiers as from_tickerid: extended or regular hours, adjustment mode, back-adjustment and any chart-type conversion.

It lets a second symbol you request follow the chart's own settings, so two series compare like with like.

Syntax

Pine Script
ticker.inherit(from_tickerid: simple string, symbol: simple string) -> simple string
ticker.inherit(from_tickerid: series string, symbol: series string) -> series string

Arguments

NameTypeDefaultDescription
from_tickeridsimple/series stringrequiredThe ticker id whose settings are copied, such as syminfo.tickerid.
symbolsimple/series stringrequiredThe symbol that receives them, for example "AMEX:SPY".

Returns

simple/series string: A ticker id string. Pass it to request.security as its symbol argument.

Remarks

  • Only the settings are copied, never the symbol name of from_tickerid.

Example

Pine ScriptBenchmark on the chart's settingsOpen in editor
//@version=6
indicator("Benchmark", overlay = false)
benchId = ticker.inherit(syminfo.tickerid, "AMEX:SPY")
bench = request.security(benchId, timeframe.period, close)
plot(close / close[1] - 1, "This symbol", color.blue)
plot(bench / bench[1] - 1, "SPY", color.gray)

See also

Runs on Sidechair