1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
127 lines of Pine Script v4 from research/chart_type_identifier.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.
chart_type_identifier.pine
//@version=4
// Copyright (c) 2019-present, Alex Orekhov (everget)
// Chart Type Identifier script may be freely distributed under the terms of the GPL-3.0 license.
study("Chart Type Identifier", overlay=true)
max = max(open, close)
min = min(open, close)
body = abs(close - open)
var int horizCount = -1
if open[1] == close or close[1] == open
horizCount := horizCount + 1
var int gapsCount = -1
if low[1] > high or high[1] < low
gapsCount := gapsCount + 1
var int noWicksCount = -1
if max == high and min == low
noWicksCount := noWicksCount + 1
//------------------------------------------------------------------------------
_isHA() =>
var int oc2Count = -1
oc2Count := open == (open[1] + close[1]) / 2 ? oc2Count + 1 : oc2Count
out = oc2Count == bar_index - 1 and oc2Count != -1 and gapsCount == -1
out
isHA = _isHA()
_isRenko() =>
bodySum = cum(body)
avg = bodySum / (bar_index + 1)
out = avg == body and gapsCount == -1
out
isRenko = _isRenko()
_isKagi() =>
out = noWicksCount == bar_index and horizCount == bar_index - 1 and gapsCount == -1
out
isKagi = _isKagi()
_isPnF() =>
var int sum = 0
sum := close > close[1] ? sum + 1 : close < close[1] ? sum - 1 : sum
out = (sum == 1 or sum == 0 or sum == -1) and horizCount < bar_index - 1
out
isPnF = _isPnF()
_isLineBreak() =>
out = noWicksCount == bar_index and horizCount < bar_index - 1 and gapsCount == -1
out
isLineBreak = not isPnF and _isLineBreak()
monthData = security(syminfo.tickerid, "M", close)
weekData = security(syminfo.tickerid, "W", close)
dayData = security(syminfo.tickerid, "D", close)
hourData = security(syminfo.tickerid, "60", close)
minuteData = security(syminfo.tickerid, "1", close)
_isRangeBars() =>
out =
timeframe.period != "S" and
minuteData == monthData and
minuteData == weekData and
minuteData == dayData and
minuteData == hourData and
minuteData == close
out
isRangeBars = _isRangeBars()
isClassic =
not isHA and
not isRenko and
not isKagi and
not isPnF and
not isLineBreak and
not isRangeBars
labelText =
bar_index < 2 ? "\nNot enough bars to identify Chart Type\n" :
isHA ? "\nThis is Heikin-Ashi Chart\n" :
isRenko ? "\nThis is Renko Chart\n" :
isKagi ? "\nThis is Kagi Chart\n" :
isRangeBars ? "\nThis is Range Bars Chart\n" :
isPnF ? "\nThis is P&F Chart\n" :
isLineBreak ? "\nThis is Line Break Chart\n" :
isClassic ? "\nThis is Classic Chart\n" :
"\nUnknown Chart Type\n"
labelColor = #1e90ff
whiteColor = color.white
var label l = label.new(
x=bar_index,
y=na,
text="",
color=labelColor,
textcolor=whiteColor,
style=label.style_labeldown,
size=size.normal
)
_highest(length) =>
out = high
for i = 1 to length - 1
prev = nz(high[i])
out := out < prev ? prev : out
out
lookback = min(bar_index + 2, 50)
yPos = _highest(lookback)
// debug =
// "\nBar Index: " + tostring(int(bar_index)) +
// "\nGaps: " + tostring(gapsCount) +
// "\nHoriz: " + tostring(horizCount) +
// "\nNo Wicks: " + tostring(noWicksCount)
label.set_text(l, labelText) // + debug
label.set_xy(l, bar_index, yPos)
Overview
Chart Type Identifier counts gaps, horizontal open-close links, and wickless bars, then tests Heikin-Ashi open formulas, equal Renko bodies, Kagi and line-break patterns, Point and Figure direction, and range bars by comparing one-minute closes with higher timeframes. A single label above recent highs states the detected type, or that there are not enough bars. There are no inputs. The label can change while the live bar is still forming.
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.
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
This indicator classifies each bar as bull, bear, or sideways from a rolling log return compared with adjustable percentage thresholds. It paints a regime ribbon on the price chart, shows a current-regime banner, and labels state changes after a minimum hold.
This script plots three moving averages on the price chart: a fast EMA or SMA with 10 periods, a slow EMA or SMA with 20 periods, and a trend EMA or SMA with 100 periods. It signals trend changes by drawing a white cross when the fast moving average crosses ab
This indicator calculates an ATR trailing stop line derived from the highest high minus an average true range multiple over a specified lookback period. It plots the trailing stop line directly on the price chart and colors price bars based on whether the clos
1833 Tracker is an overlay indicator that visualizes historical buy and sell transactions executed by ARK Invest ETFs for the stock on the main price chart. It displays trade dates using green buy and red sell labels positioned relative to price bars, indicati
This indicator plots external buy and sell signals directly on the price chart. It reads comma-separated timestamp strings for buy and sell events, checks whether the current chart matches the specified ticker symbol, and displays green upward triangles below