
Before this I read charts manually to identify bullish and bearish engulfing pattern. Then I thought why not just do some scripting and make it automatic?
I know TradingView allows us to write our own script using Pine Script language. With some manual reading and try & error, here is the script to get perfect bullish and bearish engulfing in TradingView.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © CH
//@version=4
study("Bullish & Bearish Engulfing", overlay=true)
// Make sure the shadow is bigger than previous candle
engulfShadow = high > high[1] and low < low[1]
// Check the Bullish Engulfing
bullEngulf = open[1] > close[1] and open < close and close >= open[1] and open <= close[1] and engulfShadow
// Check the Bearish Engulfing
bearEngulf = open[1] < close[1] and open > close and close <= open[1] and open >= close[1] and engulfShadow
// Plot the 'triangle'
plotshape(bullEngulf, title="Bullish Engulf", location=location.belowbar, transp=0, style=shape.triangleup, text="Bullish Engulf", size=size.auto, color=color.blue)
plotshape(bearEngulf, title="Bearish Engulf", location=location.abovebar, transp=0, style=shape.triangledown, text="Bearish Engulf", size=size.auto, color=color.red)
You may click the above image to get a better view on how it works.
And just a quick note, make sure to confirm the engulfing pattern before you make any entry.
Leave a Reply