Candle Breakout Indicator

This is a simple indicator for setting candle breakout alerts. You will get a notification when price breaks and closes above or below the threshold you set.

How It Works

You set the long breakout and short breakout price, then the script waits until a candle breaks and closes beyond either of those zones. You can set one zone or both zones.

The only difference between this and a normal TradingView horizontal price alert is that you will not get an alert unless the candle closes beyond the level.


Long Breakout Price:
This sets the Long breakout price. Set it to zero to disable.

Short Breakout Price:
This sets the Short breakout price. Set it to zero to disable.

This tells the script how far to offset the rendered line from the current candle. This is for drawing purposes only and shouldn’t need to be modified.

Source Code

// Created by Matthew J. Slabosz
// @version=3
study(title = "MJS - Breakout Indicator", shorttitle="BKOI", overlay = true, precision=5)

// Get user input
longBreakout = input(0.0, minval=0.0, title="Long Breakout Price:")
shortBreakout = input(0.0, minval=0.0, title="Short Breakout Price:")
off = input(5, minval=0, title="Offset")
longAlert =longBreakout > 0 and close > longBreakout
shortAlert = shortBreakout > 0 and close < shortBreakout

// Plot data to chart
plot(longBreakout > 0 ? longBreakout : na, title="Long Breakout Price", color=green, transp=0, linewidth=1, offset=off)
plot(shortBreakout > 0 ? shortBreakout : na, title="Short Breakout Price", color=red, transp=0, linewidth=1, offset=off)

// Send out an alert if this candle meets our conditions
alertcondition(longAlert or shortAlert, title="Breakout Alert!", message="Breakout signal for XXX")

Last Updated: 21st March, 2019

TradingView Charting Platform

Leave a Comment, Question or Suggestion