patrickestarian

Patrick's Buy/Sell Histogram

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

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
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)
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")