Indicator · Pine Script v5 · On the chart

Candle Body Wick Alerts

by g-moe· code credited to goodgains

Candle Body Wick Alerts identifies candles with minimal or missing wicks based on comparisons between open, high, low, and close values.

View on GitHub

GitHub stars3on the repository
Pine versionv5runs as is
Lines of code107
Settings14inputs
LicenceNone statedfile: MPL-2.0
Last update5 months ago27 May 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

107 lines of Pine Script v5 from Tradingview/candle-body-wick-alerts.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

candle-body-wick-alerts.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © goodgains


//@version=5
indicator("Candle Body Wick Alerts", overlay = true)

// @keywords: candle-body-wick-alerts, candle-wick, wickless-candle, marubozu, low-open-same, high-close-same, high-open-same, low-close-same, bullish-candle, bearish-candle, candle-patterns, ohlc-comparison, price-tolerance, minimal-wick, no-lower-wick, no-upper-wick, alerts, horizontal-lines, paint-bars, price-levels

//
//INPUTS
//
//bullish candles
alert_bull_low_open = input.bool(true, title = 'Alert Bullish Low/Open Same', group = 'Alert Types')
alert_bull_high_close = input.bool(true, title = 'Alert Bullish High/Close Same', group = 'Alert Types')

//bearish candles
alert_bear_low_open = input.bool(true, title = 'Alert Bearish Low/Open Same', group = 'Alert Types')
alert_bear_high_close = input.bool(true, title = 'Alert Bearish High/Close Same', group = 'Alert Types')

allowed_difference = input.float(0.02, title = 'Allowed Difference', group = 'Settings')

color_candles = input.string('Both', title = 'Color Candles',options = ['Both', 'Bull', 'Bear', 'None'], group = 'Visual Settings', inline = '1')
show_lines = input.bool(true, "Show Lines", group = 'Visual Settings', inline = '2')
number_of_lines = input.int(10, minval = 1, maxval = 50, title = '   |   Number of Lines', group = 'Visual Settings', inline = '2')
bull_alert_color = input.color(color.new(#00ff0b,0), title = "Bull Candle Color", group = 'Visual Settings', inline = '3')
bear_alert_color = input.color(color.new(#ff00e8,0), title = "Bear Candle Color", group = 'Visual Settings', inline = '3')

//
//LOGIC
//
bull_low_open = alert_bull_low_open and math.abs(low - open) <= allowed_difference and close > open 
bull_high_close = alert_bull_high_close and math.abs(high - close) <= allowed_difference and close > open

bear_high_open = alert_bear_low_open and math.abs(high - open) <= allowed_difference and close < open
bear_low_close = alert_bear_high_close and math.abs(low - close) <= allowed_difference and close < open

//
//CANDLE COLORS
//
var color candle_color = na
if color_candles == 'Both'
    if bull_low_open or bull_high_close 
        candle_color := bull_alert_color
    else if bear_high_open or bear_low_close 
        candle_color := bear_alert_color
    else
        candle_color := na
else if color_candles == 'Bull'
    if bull_low_open or bull_high_close 
        candle_color := bull_alert_color
    else
        candle_color := na
else if color_candles == 'Bear'
    if bear_high_open or bear_low_close
        candle_color := bear_alert_color
    else
        candle_color := na
else
    candle_color := na
barcolor(color = candle_color, title = 'Candle Color', editable = false)


bull_line_color = input.color(color.new(#00ff0b,0), title = "Bull Line Color", group = 'Visual Settings', inline = '4')
bear_line_color = input.color(color.new(#ff00e8,0), title = "Bear Line Color", group = 'Visual Settings', inline = '4')
line_width_input = input.int(1, minval = 1, maxval = 5, title = "Line Width", group = 'Visual Settings', inline = '5')
line_style_input = input.string('Solid', title = 'Line Style', options = ['Solid', 'Dotted', 'Dashed'], group = 'Visual Settings', inline = '5')
line_style_var = line_style_input == 'Solid' ? line.style_solid : line_style_input == 'Dotted' ? line.style_dotted : line_style_input == 'Dashed' ? line.style_dashed : na

var line[] bull_lines = array.new_line()
var line[] bear_lines = array.new_line()

//
//ALERTS & UPDATE VALUES
//
if bull_low_open and barstate.isconfirmed //line is at low
    alert("Bullish, Low = Open", alert.freq_once_per_bar)
    if show_lines
        array.push(bull_lines, line.new(x1=bar_index, x2=bar_index + 1, y1=low, y2=low, xloc=xloc.bar_index, width=line_width_input, color=bull_line_color, extend=extend.right, style = line_style_var))

if bull_high_close and barstate.isconfirmed //line is at high
    alert("Bullish, High = Close", alert.freq_once_per_bar)
    if show_lines
        array.push(bull_lines, line.new(x1=bar_index, x2=bar_index + 1, y1=high, y2=high, xloc=xloc.bar_index, width=line_width_input, color=bull_line_color, extend=extend.right, style = line_style_var))

if bear_high_open and barstate.isconfirmed //line it at high
    alert("Bearish, High = Open", alert.freq_once_per_bar)
    if show_lines
        array.push(bear_lines, line.new(x1=bar_index, x2=bar_index + 1, y1=high, y2=high, xloc=xloc.bar_index, width=line_width_input, color=bear_line_color, extend=extend.right, style = line_style_var))

if bear_low_close and barstate.isconfirmed //line is at low
    alert("Bearish, Low = Close", alert.freq_once_per_bar)
    if show_lines
        array.push(bear_lines, line.new(x1=bar_index, x2=bar_index + 1, y1=low, y2=low, xloc=xloc.bar_index, width=line_width_input, color=bear_line_color, extend=extend.right, style = line_style_var))



//
//Delete Lines
//
delete_lines(array_var) =>
    if array.size(array_var) > number_of_lines
        ln = array.shift(array_var)
        line.delete(ln)

delete_lines(bull_lines)
delete_lines(bear_lines)

Overview

Candle Body Wick Alerts checks if the price distance between key levels (such as open and low or high and close) falls within a set tolerance threshold. Matching bullish or bearish candles are highlighted directly on the main price chart with custom bar colors. The indicator can also plot horizontal lines from these key levels. Settings allow traders to adjust the tolerance distance, toggle specific candle patterns, and customize display colors and line styles.

Details

Published by

g-moe on GitHub

Code credit

goodgains, as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Candlestick patterns, Support & resistance

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.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Alert Bullish Low/Open Samebooltruealert_bull_low_open
Alert Bullish High/Close Samebooltruealert_bull_high_close
Alert Bearish Low/Open Samebooltruealert_bear_low_open
Alert Bearish High/Close Samebooltruealert_bear_high_close
Allowed Differencefloat0.02allowed_difference
Color CandlesstringBothcolor_candles
Show Linesbooltrueshow_lines
| Number of Linesint10number_of_lines
Bull Candle Colorcolorcolor.new(#00ff0b,0)bull_alert_color
Bear Candle Colorcolorcolor.new(#ff00e8,0)bear_alert_color
Bull Line Colorcolorcolor.new(#00ff0b,0)bull_line_color
Bear Line Colorcolorcolor.new(#ff00e8,0)bear_line_color
Show all 14 settings
SettingTypeDefaultVariable
Line Widthint1line_width_input
Line StylestringSolidline_style_input
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

[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

Candlestick Patterns

by harryguiacorn
219 stars

This indicator plots optional candlestick pattern signals on the price chart. It detects engulfing bars, inside bars, HOLP and LOHP, kicker patterns, body-mass extremes, higher highs and lower lows, ATR warnings, and four-bar fractals. Optional pivot marks use

Indicator v5 Candlestick patternsVolatility & bands
Updated 1 year ago · None stated GitHub repository of Candlestick Patterns

Strat Assistant

by rickyzcarroll
90 stars

The Strat Assistant indicator identifies candlestick patterns from the STRAT methodology on the price chart. It detects inside bars, 2-candle directional bars, 3-candle outside bars, and sequences like 212 and 222 for continuations and reversals. Shapes such a

Indicator v4 Candlestick patternsSupport & resistance
Updated 5 years ago · None stated GitHub repository of Strat Assistant
56 stars

This overlay indicator highlights candles with a body smaller than 50% of their total range by coloring them white on the price chart. Simultaneously, it calculates and plots horizontal lines for open prices across multiple higher timeframes, such as daily, we

Indicator v6 Support & resistanceCandlestick patterns Repaints
Updated 2 months ago · None stated GitHub repository of Daily Weekly Monthly Yearly Opens

This Pine Script indicator identifies liquidity sweeps and confirms signals using a close-back candle pattern directly on the price chart. It tracks recent swing highs and lows over a customizable lookback period. A bullish signal forms when a prior bar sweeps

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · MPL-2.0 GitHub repository of Liquidity Sweep + Close-Back Confirmation

8020 System Indicator

by TamaraKGreen
46 stars

This overlay indicator draws 80/20 price levels and optional 40-point zone bands on the price chart. It marks repairs, cross sections, and forks with optional letter labels, and can highlight confluence when those marks sit near a level. Separate options shade

Indicator v6 Support & resistanceCandlestick patterns
Updated 7 weeks ago · None stated GitHub repository of 8020 System Indicator

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