# Candlestick Patterns With EMA and Stochastic

861 0
Candlestick patterns identified and color coded according to position above or below 8EMA(TLine).
Special thanks to repo32, DavidR, and Chris Moody for coding ideas.

Bullish candlestick buy signals have a greater probability of success when Stochastics are oversold. Bearish ones have a
greater probability of success when overbought. Stack as many factors in your favor as possible. A candlestick signal by itself is of little value unless you apply additional information with it. Regardless of systems and strategies used, make your second trade first: Know when you're going to exit. Risk management rules. Good luck and good trading.
```//Created by Robert Waddell with special thanks to repo32 for his candlestick ID code, DavidR for EMA code and Chris Moody for barcolor code.
//Also a shameless plug for repo32's "Price above/below EMA" and Chris Moody's "Stochastic MTF"
//6/5/15
//Candlestick patterns are identified above or below the price action.
study(title ="Candlestick Patterns With EMA and Stochastic", overlay = true)

length = input(12, minval=1), smoothK = input(3, minval=1), smoothD = input(3, minval=1)
k = sma(stoch(close, high, low, length), smoothK)
d = sma(k, smoothD)

DojiSize = input(0.05, minval=0.01, title="Doji size")
dj=(abs(open - close) <= (high - low) * DojiSize)
plotchar(dj, title="Doji", text='Doji', color=white)

es = (close[2] > open[2] and min(open[1], close[1]) > close[2] and open < min(open[1], close[1]) and close < open and close > .5 * open - close)
plotshape(es, title= "Evening Star",offset = -1, color=red, style=shape.arrowdown, text="Evening\nStar")

ms = (close[2] < open[2] and max(open[1], close[1]) < close[2] and open > max(open[1], close[1]) and close > .5 * close - open)
plotshape(ms,  title= "Morning Star",offset = -1, location=location.belowbar, color=lime, style=shape.arrowup,  text="Morn\nStar")

ss = (open[1] < close[1] and open > close[1] and high - max(open, close) >= abs(open - close) * 3 and min(close, open) - low <= abs(open - close))
plotshape(ss, title= "Shooting Star", location=location.belowbar, color=lime, style=shape.arrowup, text= "Shoot\nStar")

ih=(((high - low)>3*(open -close)) and  ((high - close)/(.001 + high - low) > 0.6) and ((high - open)/(.001 + high - low) > 0.6))
plotshape(ih, title= "Inverted Hammer", location=location.belowbar, color=white, style=shape.diamond, text="IH")

h=(((high - low)>3*(open -close)) and  ((close - low)/(.001 + high - low) > 0.6) and ((open - low)/(.001 + high - low) > 0.6))
plotshape(h, title= "Hammer", location=location.belowbar, color=white, style=shape.diamond, text="H")

beh = (close[1] > open[1] and open > close and open <= close[1] and open[1] <= close and open - close < close[1] - open[1] )
plotshape(beh, title= "Bearish Harami",  color=orange, style=shape.arrowdown, text="Bear\nHarami")

blh = (open[1] > close[1] and close > open and close <= open[1] and close[1] <= open and close - open < open[1] - close[1] )
plotshape(blh,  title= "Bullish Harami", location=location.belowbar, color=lime, style=shape.arrowup, text="Bull\nHarami")

bee = (close[1] > open[1] and open > close and open >= close[1] and open[1] >= close and open - close > close[1] - open[1] )
plotshape(bee,  title= "Bearish Engulfing", color=orange, style=shape.arrowdown, text="Bearish\nEngulf")

ble = (open[1] > close[1] and close > open and close >= open[1] and close[1] >= open and close - open > open[1] - close[1] )
plotshape(ble, title= "Bullish Engulfing", location=location.belowbar, color=lime, style=shape.arrowup, text="Bullish\nEngulf")

upper = highest(10)[1]
ps = (close[1] < open[1] and  open < low[1] and close > close[1] + ((open[1] - close[1])/2) and close < open[1])
plotshape(ps, title= "Piercing Line", location=location.belowbar, color=lime, style=shape.arrowup, text="Pierc\nSig")

blk = (open[1]>close[1] and open>=open[1] and close>open)
plotshape(blk, title= "Bullish Kicker", location=location.belowbar, color=lime, style=shape.arrowup, text="Bull\nKick")

bek = (open[1]<close[1] and open<=open[1] and close<=open)
plotshape(bek, title= "Bearish Kicker", color=orange, style=shape.arrowdown, text="Bear\nKick")

dcc = ((close[1]>open[1])and(((close[1]+open[1])/2)>close)and(open>close)and(open>close[1])and(close>open[1])and((open-close)/(.001+(high-low))>0.6))
plotshape(dcc, title= "Dark Cloud Cover", color=orange, style=shape.arrowdown, text="Dark\nCloud")

TLineEMA = input(8, minval=1, title="Trigger Line")
TLine = ema(close, TLineEMA)

plot(TLine, color=yellow, title="T-Line EMA", linewidth=1)

aboveTLine = close < close[1] and close < TLine
belowTLine = close > close[1] and close > TLine

barcolor(ms and belowTLine and k <= 25 and d <= 25 ? yellow : na)
barcolor(bek and aboveTLine and k >= 75 and d >= 75 ? fuchsia : na)
barcolor(ps and belowTLine and k <= 25 and d <= 25 ? yellow : na)
barcolor(blk and belowTLine and k <= 25 and d <= 25 ? yellow : na)
barcolor(ble and belowTLine ? yellow : na)
barcolor(dcc and aboveTLine ? fuchsia : na)
barcolor(h and belowTLine and k <= 25 and d <= 25 ? yellow : na)
barcolor(ih and belowTLine and k <= 25 and d <= 25 ? yellow : na)
barcolor(ss and aboveTLine and k >= 75 and d >= 75 ? fuchsia : na)
barcolor(es and aboveTLine and k >= 75 and d >= 75 ? fuchsia : na)
barcolor(dj or ih or beh and aboveTLine and k >= 75 and d >= 75 ? fuchsia : na)
barcolor(dj and belowTLine and k <= 25 and d <= 25 ? yellow : na)```
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter