Sidechair

ticker.kagi()

Browse the reference

Builds a ticker id that serves a Kagi chart for a symbol, reversing after a set price move.

Try it in the editor

ticker.kagi(symbol, reversal) returns an id that request.security turns into a Kagi series. A Kagi line keeps extending while price continues in its direction and starts a new line when price reverses by the reversal amount. Time plays no part.

The second form, ticker.kagi(symbol, param, style), sets the reversal either from an ATR length ("ATR") or as a fixed size ("Traditional").

Syntax

Pine Script
ticker.kagi(symbol: simple string, reversal: simple int/float) -> simple string
ticker.kagi(symbol: series string, reversal: series int/float) -> series string
ticker.kagi(symbol: simple string, param: simple int/float, style: series string) -> simple string
ticker.kagi(symbol: series string, param: series int/float, style: series string) -> series string

Arguments

NameTypeDefaultDescription
symbolsimple/series stringrequiredThe ticker id to convert, such as syminfo.tickerid.
reversalsimple/series int/floatrequiredHow far price must move against the current line before the chart reverses.
paramsimple/series int/floatrequiredWith a style: the ATR length for "ATR", or the reversal size for "Traditional".
styleseries stringrequiredHow the reversal is set: "ATR" or "Traditional".

Returns

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

Remarks

  • A smaller reversal gives more lines and more noise; a larger one gives fewer, slower reversals.

Example

Pine ScriptKagi close with an ATR reversalOpen in editor
//@version=6
indicator("Kagi close", overlay = true)
kagiId = ticker.kagi(syminfo.tickerid, 14, "ATR")
kagiClose = request.security(kagiId, timeframe.period, close)
plot(close, "Close", color.gray)
plot(kagiClose, "Kagi close", color.orange, style = plot.style_stepline)

See also

Runs on Sidechair