TradingView
HPotter
Apr 1, 2014 4:36 AM

Bullish Engulfing automatic finding script 

描述

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.

版本注释

- Move to v5
- Added alerts
评论
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
mohan2013
Learning indicator
korabforex
Hi, I am using this indicator for 2-3 days and I think its one the best till now.. good job 👍
Axeman007
Explain the precision setting please.
AsherAndres
Could you by any chance add or make another indicator with a input function to turn on/off bullish an bearish engulfing Candlestick pattern as well another input for color change?? This would help so many people to have access to both bearish and bullish in one script with input functions, all us traders need somthing as mentioned above 😇🙏.
更多