Indicator · Pine Script v4 · On the chart

Kagi Chart Identifier

by everget

This indicator checks whether the current chart uses Kagi chart formatting.

View on GitHub

GitHub stars948on the repository
Pine versionv4older, still runs
Lines of code40
Settings0inputs
LicenceGPL-3.0
Last update10 days ago18 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

40 lines of Pine Script v4 from research/kagi_chart_identifier.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

kagi_chart_identifier.pine
//@version=4
// Copyright (c) 2019-present, Alex Orekhov (everget)
// Kagi Chart Identifier script may be freely distributed under the terms of the GPL-3.0 license.
study("Kagi Chart Identifier", overlay=true)

var ocCount = -1
if open[1] == close or close[1] == open
    ocCount := ocCount + 1

var hCount = -1
if open == high or close == high
    hCount := hCount + 1

var lCount = -1
if open == low or close == low
    lCount := lCount + 1

isKagi = hCount == bar_index and lCount == bar_index and ocCount == bar_index - 1

labelText = isKagi ? "This is Kagi Chart" : "This is not Kagi Chart"
stats = "\n------------------------------" +
         "\nBar Index: " + tostring(int(bar_index)) +
         "\nO==C Candles: " + tostring(ocCount) +
         "\nOC==H Candles: " + tostring(hCount) +
         "\nOC==L Candles: " + tostring(lCount)
labelColor = #1e90ff
whiteColor = color.white

var label kagiLabel = label.new(
     x=bar_index,
     y=na,
     text="",
     color=labelColor,
     textcolor=whiteColor,
     style=label.style_labeldown,
     size=size.normal
     )

label.set_text(kagiLabel, labelText + stats)
label.set_xy(kagiLabel, bar_index, highest(close, 10))

Overview

Kagi Chart Identifier analyzes price bar structural characteristics by counting bars where open or close equals the high, low, and adjacent open/close levels across the history. An informational label displays directly on the main chart, indicating whether the series satisfies Kagi criteria alongside running tally statistics. It contains no configurable user inputs or trade signals.

Details

Published by

everget on GitHub

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Candlestick patterns

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

pinepinescripttechnical-indicatorsindicatorsoscillatorbandsaveragetradingviewindicatormoving-average

Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

575 stars

The indicator plots ICT displacement candles on the price chart and can switch to retracement scanning. Displacement requires a move larger than a set share of the 14-bar average high-low range, lasting at least a chosen number of bars, with optional close, pr

Indicator v6 SMC / ICT / price actionCandlestick patterns
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Displacement Candles Indicator

All Candlestick Patterns

by shunjizhan
292 stars

All Candlestick Patterns detects and highlights a wide range of bullish, bearish, and neutral candlestick patterns directly on the price chart. It features optional trend filtering using either a 50-period simple moving average or a combination of 50-period an

Indicator v4 Candlestick patternsTrend
Updated 3 years ago · None stated GitHub repository of All Candlestick Patterns
285 stars

Mean Reversion Study is an indicator that identifies trade setups combining exponential moving averages, RSI extremes, and engulfing candlestick patterns. It highlights bullish setups when a bullish engulfing candle forms below the EMA while RSI is oversold, a

Indicator v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Study

[RS]MTF Candle Sticks

by ricardosantos79
261 stars

This indicator overlays up to five higher-timeframe candlestick groups on the price chart. For each enabled timeframe it requests open, high, low, and close and can show up to five candles, offset by a spacing setting. The main inputs set the candle count, the

Indicator v4 Candlestick patternsSupport & resistance Repaints
Updated 4 years ago · None stated GitHub repository of [RS]MTF Candle Sticks
257 stars

This indicator detects a large set of classic candlestick patterns and plots colored labels on the price chart. Trend context uses a 50-period simple moving average, or the 50 and 200 averages stacked together, and can be switched off. Users filter bullish, be

Indicator v4 Candlestick patternsTrend
Updated 6 weeks ago · None stated GitHub repository of Snag - All Candlestick Patterns

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers