Builds a ticker id from a prefix and a symbol name, with optional session, adjustment and back-adjustment settings.
ticker.new(prefix, ticker, ...) joins the two parts with a colon and attaches the settings you pick, so you can ask request.security for the extended-hours or split-adjusted version of a symbol regardless of the chart's own settings.
Use it when the symbol is known as two separate strings. To keep a chart symbol's own prefix and change only some settings, use ticker.modify instead.
Syntax
ticker.new(prefix: simple string, ticker: simple string, session: simple string (optional), adjustment: simple string (optional), backadjustment: simple backadjustment (optional), settlement_as_close: simple settlement (optional)) -> simple string
ticker.new(prefix: series string, ticker: series string, session: series string (optional), adjustment: series string (optional), backadjustment: simple backadjustment (optional), settlement_as_close: simple settlement (optional)) -> series stringArguments
| Name | Type | Default | Description |
|---|---|---|---|
| prefix | simple/ | required | The exchange prefix of the symbol, such as "NASDAQ" or "NYSE". |
| ticker | simple/ | required | The symbol name without a prefix, such as "AAPL" or "IBM". |
| session | simple/ | session. | Which hours to use: session.regular or session.extended. |
| adjustment | simple/ | adjustment. | How prices are adjusted for corporate actions: adjustment.none, adjustment.splits or adjustment.dividends. |
| backadjustment | simple backadjustment | backadjustment. | Whether a futures chain is back-adjusted at each roll: backadjustment.on, backadjustment.off or backadjustment.inherit (use the setting of the requested symbol). |
| settlement_as_close | simple settlement | settlement_as_close. | Whether a futures day closes at the settlement price: settlement_as_close.on, settlement_as_close.off or settlement_as_close.inherit. |
Returns
simple/series string: A ticker id string. Pass it to request.security as its symbol argument.
Remarks
- The arguments must be simple strings or constants that are known when the script starts, except in the series overload, where they may change bar to bar.
- Back-adjustment and settlement only apply to futures symbols and are ignored for the rest.
Examples
//@version=6
indicator("Extended close", overlay = true)
id = ticker.new("NASDAQ", "AAPL", session.extended, adjustment.splits)
other = request.security(id, timeframe.period, close)
plot(close, "Close", color.gray)
plot(other, "AAPL extended", color.orange)//@version=6
indicator("Futures root", overlay = true)
id = ticker.new("CME_MINI", "ES1!", session.regular)
other = request.security(id, timeframe.period, close)
plot(close, "Close", color.gray)
plot(other, "ES1! close", color.orange)See also
Runs on Sidechair