The Breakaway Pattern Recognition in TradingView
Coding the Breakaway Candlestick Pattern Scanner in TradingView
Candlestick patterns are a great addition to market analysis. Some may even consider them vital in research and trading. This article presents the Breakaway pattern and shows how to code a scanner in TradingView that detects it.
The Breakaway Pattern
Candlestick charts are among the most famous ways to analyze the time series visually. They contain more information than a simple line chart and have more visual interpretability than bar charts.
The Breakaway pattern is a five-candle configuration that represents a change of dynamic of a severe one-sided move.
The bullish Breakaway is composed of four bearish candlesticks where ideally the second one gaps below the first one, then a fifth big bullish candlestick closes above the open of the second bearish candlestick. The following Figure shows a theoretical illustration of the bullish Breakaway.
The bearish Breakaway is composed of four bullish candlesticks where ideally the second one gaps above the first one, then a fifth big bearish candlestick closes below the open of the second bullish candlestick. The following Figure shows a theoretical illustration of the bearish Breakaway.
If you want to see more of my work, you can visit my website for the books catalogue by simply following this link:
Coding the Scanner in TradingView
The conditions of the pattern are relatively easy to code especially in a straightforward and simple coding language such as Pine Script, TradingView’s native language.
The aim of the scanner is to detect the Breakaway patterns using the following indications:
A green arrow for bullish Breakaway signals.
A red arrow for bearish Breakaway signals.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Sofien-Kaabar
//@version=5
indicator("Candlestick Pattern - Breakaway", overlay = true)
bullish_breakaway = close > open[3] and close > open and close[1] < open[1] and close[2] < open[2] and close[3] < open[3] and close[4] < open[4] and open[3] < close[4]
bearish_breakaway = close < open[3] and close < open and close[1] > open[1] and close[2] > open[2] and close[3] > open[3] and close[4] > open[4] and open[3] > close[4]
plotshape(bullish_breakaway, style = shape.triangleup, color = color.green, location = location.belowbar, size = size.small)
plotshape(bearish_breakaway, style = shape.triangledown, color = color.red, location = location.abovebar, size = size.small)
The following Figure shows a signal chart after the code has been applied and executed. Bear in mind that this pattern is quite rare.
The following Figure shows another signal chart.
You can also check out my other newsletter The Weekly Market Sentiment Report that sends weekly directional views every weekend to highlight the important trading opportunities using a mix between sentiment analysis (COT report, put-call ratio, etc.) and rules-based technical analysis.
If you liked this article, do not hesitate to like and comment, to further the discussion!