Discover more from All About Trading!
The Blockade Pattern Recognition in TradingView
Coding an Blockade 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 Blockade pattern and shows how to code a scanner in TradingView that detects it.
For the complete collection of candlestick patterns in detail with back-tests and technical strategies, you can check out my newest book with O’Reilly Media. The book features a huge number of classic and modern candlestick patterns as it dwelves into the realm of technical analysis with different trading strategies. The book comes with its own GitHub and is dynamic in nature as it is continuously updated and questions are answered on the O’Reilly platform promptly.
The Blockade 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 Blockade pattern is a stabilization and reversal pattern composed of four candlesticks.
The bullish Blockade is composed of a bullish candlestick that surpasses the high of a bearish candlestick three periods ago. At the same time, its low should be contained within the bearish candlestick’s low and its close. The two intermediate candlesticks’ highs should not surpass the high of the bearish candlestick. The following Figure shows a theoretical illustration of the bullish Blockade.
The bearish Blockade is composed of a bearish candlestick that breaks the low of a bullish candlestick three periods ago. At the same time, its high should be contained within the bullish candlestick’s high and its close. The two intermediate candlesticks’ lows should not break the low of the bullish candlestick. The following Figure shows a theoretical illustration of the bearish Blockade.
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 Blockade patterns using the following indications:
A green arrow for bullish Blockade signals.
A red arrow for bearish Blockade 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
indicator("Candlestick Pattern - Blockade", overlay = true)
bullish_blockade = close > open and close < open and low >= low and low <= close and close > high and low >= low and low <= close and low >= low and low <= close and high < high and high < high bearish_blockade = close < open and close > open and high <= high and high >= close and close < low and high <= high and high >= close and high <= high and high >= close and low > low and low > low
plotshape(bullish_blockade, style = shape.triangleup, color = color.green, location = location.belowbar, size = size.small) plotshape(bearish_blockade, 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.
The following Figure shows another signal chart.
If you want to see how to create all sorts of algorithms yourself, feel free to check out Lumiwealth. From algorithmic trading to blockchain and machine learning, they have hands-on detailed courses that I highly recommend.
Learn Algorithmic Trading with Python Lumiwealth
Learn how to create your own trading algorithms for stocks, options, crypto and more from the experts at Lumiwealth. Click to learn more