# Patrick's Buy/Sell Histogram

Simply look for a 12 point long bar and that's a perfect time to buy the security

オープンソーススクリプト

チャートでこのスクリプトを利用したいですか？
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)
uplo=trnd1+trnd2+trnd3+trnd4+trnd5+trnd6+trnd7
col0=iff(uplo<12, #009900, #007A00)
col1=iff(uplo<10, #4DB84D, col0)