Patrick's Buy/Sell Histogram

Simply look for a 12 point long bar and that's a perfect time to buy the security
Remove from Favorite Scripts Add to Favorite Scripts
study(title="My Index", shorttitle="Patrick's Buy/Sell Histogram", overlay=false)
len1 = input(title="EMA Len 1", type=integer, defval=16, minval=1)
len2 = input(title="EMA Len 2", type=integer, defval=4, minval=1)
len3 = input(title="Lowest Trailer Len", type=integer, defval=3, minval=1)

typical = (low + high + open + close + close) / 5
hline(0, color=gray, linewidth=1, linestyle=line, title="Zero Line")
ema1 = ema(typical, len1)
ema2 = ema(typical, len2)
diff = 100*(ema2-ema1)/ema2
plot(diff, color=blue, title="Diff Curve")
lwst = lowest(diff[1], len3)
lwstma = sma(lwst, 3)
plot(lwstma, color=red, title="Lowest Trailer")

trnd1 = iff(ema1>ema1[1]*1.001, 2, 0)
trnd2 = iff(ema2>ema2[1]*1.001, 1, 0)
trnd3 = iff(diff>=lwstma, 2, 0)
trnd4 = iff(lowest(diff[1], len2)<highest(lwstma[1], len2), 2, 0)
trnd5 = iff(diff>diff[1], 2, 0)
trnd6 = iff(low[1]>ema1[1] and low<ema1, 0, 1)
trnd7 = iff(diff<0, 1, 0)
col0=iff(uplo<12, #009900, #007A00)
col1=iff(uplo<10, #4DB84D, col0)
col2=iff(uplo<8, #ADD633, col1)
col3=iff(uplo<7, #99B280, col2)
col4=iff(uplo<5, #E0A366, col3)
col5=iff(uplo<3, #FF3333, col4)
plot(uplo, color=col5, style=histogram, linewidth=4, title="Histogram")
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 繁體中文
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
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out