Sidechair

request.splits()

Browse the reference

Requests stock split data for a symbol: the numerator or denominator of the latest split ratio.

Try it in the editor

request.splits returns one part of the most recent split ratio. A 4 for 1 split has numerator 4 and denominator 1.

Select the part with field: splits.numerator or splits.denominator. The value holds until the next split.

Syntax

Pine Script
request.splits(ticker: series string, field: series string, gaps: simple barmerge_gaps (optional), lookahead: simple barmerge_lookahead (optional), ignore_invalid_symbol: input bool (optional)) -> series float

Arguments

NameTypeDefaultDescription
tickerseries stringrequiredThe symbol to read. syminfo.tickerid is the chart's own symbol.
fieldseries stringrequiredWhich part of the ratio to return: splits.numerator or splits.denominator.
gapssimple barmerge_gapsbarmerge.gaps_offbarmerge.gaps_on leaves na between splits. barmerge.gaps_off carries the last value forward.
lookaheadsimple barmerge_lookaheadbarmerge.lookahead_offbarmerge.lookahead_off waits for a split to be on record. barmerge.lookahead_on stamps each split onto the earlier bars of its period, which uses data from the future.
ignore_invalid_symbolinput boolfalseWhen true, an unknown symbol returns na.

Returns

series float: the split figure, or na where the symbol has no split on record.

Remarks

  • The ratio is numerator divided by denominator.
  • On Sidechair: split data is not available yet. The call warns once and returns na, so the example plots nothing until it is.

Example

Pine ScriptLatest split ratioOpen in editor
//@version=6
indicator("Split ratio")
num = request.splits(syminfo.tickerid, splits.numerator)
den = request.splits(syminfo.tickerid, splits.denominator)
plot(num / den, "Ratio", color = color.purple, style = plot.style_stepline)

See also

Not on Sidechair yet