Requests stock split data for a symbol: the numerator or denominator of the latest split ratio.
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
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 floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| ticker | series string | required | The symbol to read. syminfo.tickerid is the chart's own symbol. |
| field | series string | required | Which part of the ratio to return: splits.numerator or splits.denominator. |
| gaps | simple barmerge_gaps | barmerge. | barmerge.gaps_on leaves na between splits. barmerge.gaps_off carries the last value forward. |
| lookahead | simple barmerge_lookahead | barmerge. | barmerge.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_symbol | input bool | false | When 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
//@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