TradingView
HPotter
1 de Abr de 2014 04:36

Bullish Engulfing automatic finding script 

Descrição

Hi
Let me introduce my Bullish Engulfing automatic finding script.
This is a bullish reversal pattern formed by two candlesticks. Following a downtrend,
the first candlestick is a down candlestick which is followed by an up candlestick
which has a long real body that engulfs or contains the real body of the prior bar.
The Engulfing pattern is the reverse of the Harami pattern.

Notas de Lançamento

- Move to v5
- Added alerts
Comentários
anthony.pace.102
Is there a way I can create an alert whenever a Bullish or Bearish engulfing bar forms ?
kumarmoitra185351d7ed7842bd
Good job, being new to this, may I ask you to let me know where I should put the code in TradingView?
vbaghbanrahimi
how to start trade? how to set sl and tp?
maudelebowski
So what is the indication? the yellow bars?
HPotter
@maudelebowski, That pattern Bullish Engulfing was formed.
sv8623047
hello!
can anyone change the given indicator into a strategy?
//@version=5
indicator("Engulfing - Bullish", shorttitle = "Engulfing - Bull", overlay=true)

C_DownTrend = true
C_UpTrend = true
var trendRule1 = "SMA50"
var trendRule2 = "SMA50, SMA200"
var trendRule = input.string(trendRule1, "Detect Trend Based On", options=[trendRule1, trendRule2, "No detection"])

if trendRule == trendRule1
priceAvg = ta.sma(close, 50)
C_DownTrend := close < priceAvg
C_UpTrend := close > priceAvg

if trendRule == trendRule2
sma200 = ta.sma(close, 200)
sma50 = ta.sma(close, 50)
C_DownTrend := close < sma50 and sma50 < sma200
C_UpTrend := close > sma50 and sma50 > sma200
C_Len = 14 // ta.ema depth for bodyAvg
C_ShadowPercent = 5.0 // size of shadows
C_ShadowEqualsPercent = 100.0
C_DojiBodyPercent = 5.0
C_Factor = 2.0 // shows the number of times the shadow dominates the candlestick body

C_BodyHi = math.max(close, open)
C_BodyLo = math.min(close, open)
C_Body = C_BodyHi - C_BodyLo
C_BodyAvg = ta.ema(C_Body, C_Len)
C_SmallBody = C_Body < C_BodyAvg
C_LongBody = C_Body > C_BodyAvg
C_UpShadow = high - C_BodyHi
C_DnShadow = C_BodyLo - low
C_HasUpShadow = C_UpShadow > C_ShadowPercent / 100 * C_Body
C_HasDnShadow = C_DnShadow > C_ShadowPercent / 100 * C_Body
C_WhiteBody = open < close
C_BlackBody = open > close
C_Range = high-low
C_IsInsideBar = C_BodyHi[1] > C_BodyHi and C_BodyLo[1] < C_BodyLo
C_BodyMiddle = C_Body / 2 + C_BodyLo
C_ShadowEquals = C_UpShadow == C_DnShadow or (math.abs(C_UpShadow - C_DnShadow) / C_DnShadow * 100) < C_ShadowEqualsPercent and (math.abs(C_DnShadow - C_UpShadow) / C_UpShadow * 100) < C_ShadowEqualsPercent
C_IsDojiBody = C_Range > 0 and C_Body <= C_Range * C_DojiBodyPercent / 100
C_Doji = C_IsDojiBody and C_ShadowEquals

patternLabelPosLow = low - (ta.atr(30) * 0.6)
patternLabelPosHigh = high + (ta.atr(30) * 0.6)

label_color_bullish = input(color.blue, "Label Color Bullish")
C_EngulfingBullishNumberOfCandles = 2
C_EngulfingBullish = C_DownTrend and C_WhiteBody and C_LongBody and C_BlackBody[1] and C_SmallBody[1] and close >= open[1] and open <= close[1] and ( close > open[1] or open < close[1] )
alertcondition(C_EngulfingBullish, title = "New pattern detected", message = "New Engulfing – Bullish pattern detected")
if C_EngulfingBullish
var ttBullishEngulfing = "Engulfing\nAt the end of a given downward trend, there will most likely be a reversal pattern. To distinguish the first day, this candlestick pattern uses a small body, followed by a day where the candle body fully overtakes the body from the day before, and closes in the trend’s opposite direction. Although similar to the outside reversal chart pattern, it is not essential for this pattern to completely overtake the range (high to low), rather only the open and the close."
label.new(bar_index, patternLabelPosLow, text="BE", style=label.style_label_up, color = label_color_bullish, textcolor=color.white, tooltip = ttBullishEngulfing)
bgcolor(ta.highest(C_EngulfingBullish?1
Axeman007
Explain the precision setting please.
sekhar13515
Hi.. it is very nice working. Please update this indicator as Bullish and Bearish Engulfing as a single indicator.
Gpy8
Hi, Firstly thank you for the great indicator! I just wanted to is it possible for you add the "alert " Like we can get an alert when a Yellow candle (BE) is formed. I specially need the alert for the 15 min candle. Thank you so much!
HPotter
@Gpy005, Done.
Mais