# 5 candles

96 1
4 of 5 candles bearish -> buy, bullish ->sell
```study("5 candles")
sma5=sma(close,5)
sma200=sma(close,200)
bCase1=close<close[1] and close[1]<close[2] and close[2]<close[3] and close[1]<open[1] and close[2]<open[2] and close[3]<open[3] and close<sma5 and close[1]<sma5[1] and close[2]<sma5[2] and close[3]<sma5[3] and open[3]<sma5[3]
bCase2=close<close[1] and close[1]<close[2] and close[2]<close[3] and close[4]<close[5] and close[1]<open[1] and close[2]<open[2] and close[4]<open[4] and close[5]<open[5] and close<sma5 and close[1]<sma5[1] and close[2]<sma5[2] and close[3]<sma5[3] and close[4]<sma5[4] and close[5]<sma5[5] and open[5]<sma5[5]
bCase3=close<close[1] and close[1]<close[2] and close[3]<close[4] and close[4]<close[5] and close<open  and close[1]<open[1] and close[3]<open[3]  and close[4]<open[4] and close[5]<open[5] and close<sma5 and close[1]<sma5[1] and close[2]<sma5[2] and close[3]<sma5[3] and close[4]<sma5[4] and close[5]<sma5[5] and open[5]<sma5[5]
bCase4=close<close[1] and close[2]<close[3] and close[3]<close[4] and close[4]<close[5] and close[2]<open[2] and close[3]<open[3]  and close[4]<open[4] and close[5]<open[5] and close<sma5 and close[1]<sma5[1] and close[2]<sma5[2] and close[3]<sma5[3] and close[4]<sma5[4] and close[5]<sma5[5] and open[5]<sma5[5]

sCase1=close>close[1] and close[1]>close[2] and close[2]>close[3] and close[1]>open[1] and close[2]>open[2] and close[3]>open[3] and close>sma5 and close[1]>sma5[1] and close[2]>sma5[2] and close[3]>sma5[3] and open[3]>sma5[3]
sCase2=close>close[1] and close[1]>close[2] and close[2]>close[3] and close[4]>close[5] and close[1]>open[1] and close[2]>open[2] and close[4]>open[4] and close[5]>open[5] and close>sma5 and close[1]>sma5[1] and close[2]>sma5[2] and close[3]>sma5[3] and close[4]>sma5[4] and close[5]>sma5[5] and open[5]>sma5[5]
sCase3=close>close[1] and close[1]>close[2] and close[3]>close[4] and close[4]>close[5] and close>open  and close[1]>open[1] and close[3]>open[3]  and close[4]>open[4] and close[5]>open[5] and close>sma5 and close[1]>sma5[1] and close[2]>sma5[2] and close[3]>sma5[3] and close[4]>sma5[4] and close[5]>sma5[5] and open[5]>sma5[5]
sCase4=close>close[1] and close[2]>close[3] and close[3]>close[4] and close[4]>close[5] and close[2]>open[2] and close[3]>open[3]  and close[4]>open[4] and close[5]>open[5] and close>sma5 and close[1]>sma5[1] and close[2]>sma5[2] and close[3]>sma5[3] and close[4]>sma5[4] and close[5]>sma5[5] and open[5]>sma5[5]

buy=close>sma200+(0.05*close) and close<open and (bCase1 or bCase2 or bCase3 or bCase4)
sell=close<sma200-(0.05*close) and close>open and (sCase1 or sCase2 or sCase3 or sCase4)

plot(signal, style=histogram, color=hColor, linewidth=3)```
What defines a bullish or bearish candle? Thanks.
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
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