blindfreddy

Weight of Evidence BF

**For Stocks (requires volume data) **
The premise of this indicator is that the wisdom of many is greater than one. The idea is you can throw out most of your indicators and simply adopt the Weight of the Evidence instead.

Eight indicators and five periods combine to give forty separate readings on a stock. These are all checked against a threshold to give a pass or fail score. The total is taken and a score is given out of 100 in increments of 2.5.

Four indicators are momentum-based: EMA, RSI, PercentRank, Lower Donchian Channel
Three are price-volume based:On Balance Volume, Price Volume Trend, Accumulation/Distribution
One is volatility-based: (Simplified) Volatility Stop

I have tried to make things simple with the entered periods being applied to all indicators. For some like on balance volume its actually a look back period for comparison of values. For the volatility stop I use the 3rd period for lookback and combine with 1 to 5 times ATR.

As this is a stepped function which can react rapidly it makes sense to smooth it with something like a 3-bar EMA, which is included by default.

Play around with the periods and different bar lengths to find something you like. I actually chose the default values with daily bars in mind but it seems to work well on weeklies! If you have other preferred indicators you could edit this script and substitute your own, although it is easiest to stick with the built-in functions as I have done.

Let me know how you get on with this and good trading to all!

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?
//Weight of the Evidence Indicator
//by BlindFreddy
//Blog: http://blindfreddy.postagon.com
//This script gives a score out of 100 in increments of 2.5,
//based on the 5 periods entered and the following eight indicator tests:
//1.Close>=EMA(x)   2. RSI(x)>=50   3. OBV>=OBV[x periods ago]    4. PVT>=PVT[x periods ago]
//5.Percentrank(x)>=50   6.Lower donchian channel(x period) is rising
//7. Accumulation/distribution>=A/D[x periods ago]
//8. Volatility stop : Close>=Highest(L3 periods)-n.ATR where n =1,2,3,4,5
//..where x equals L1,L2,L3,L4 and L5
//Requires Volume data ! ie intended for stocks 
study(title="Weight of Evidence BF", overlay = false)
l1 = input(3,'Length 1',minval=1)
l2 = input(5,'Length 2',minval=1)
l3 = input(10,'Length 3',minval=1)
l4 = input(20,'Length 4',minval=1)
l5 = input(50,'Length 5',minval=1)
ls= input(3,'Smoothing',minval=1)
src=close
//ema
w1=src>=ema(src,l1)? 1 : 0
w2=src>=ema(src,l2)? 1 : 0
w3=src>=ema(src,l3)? 1 : 0
w4=src>=ema(src,l4)? 1 : 0
w5=src>=ema(src,l5)? 1 : 0
//rsi
w6= rsi(src,l1)>=50? 1 : 0
w7= rsi(src,l2)>=50? 1 : 0
w8= rsi(src,l3)>=50? 1 : 0
w9= rsi(src,l4)>=50? 1 : 0
w10= rsi(src,l5)>=50? 1 : 0
//on balance volume
obv=src>src[1]? nz(obv[1])+volume: nz(obv[1])-volume
w11=obv>=obv[l1]?1:0
w12=obv>=obv[l2]?1:0
w13=obv>=obv[l3]?1:0
w14=obv>=obv[l4]?1:0
w15=obv>=obv[l5]?1:0
//price volume trend
pvt=volume*(src/src[1]-1)+nz(pvt[1])
w16=pvt>=pvt[l1]?1:0
w17=pvt>=pvt[l2]?1:0
w18=pvt>=pvt[l3]?1:0
w19=pvt>=pvt[l4]?1:0
w20=pvt>=pvt[l5]?1:0
//percentrank
w21=percentrank(src,l1)>=50?1:0
w22=percentrank(src,l2)>=50?1:0 
w23=percentrank(src,l3)>=50?1:0 
w24=percentrank(src,l4)>=50?1:0 
w25=percentrank(src,l5)>=50?1:0
//lower donchian
w26=barssince(lowest(l1)>lowest(l1)[1])<barssince(lowest(l1)<lowest(l1)[1])?1:0
w27=barssince(lowest(l2)>lowest(l2)[1])<barssince(lowest(l2)<lowest(l2)[1])?1:0
w28=barssince(lowest(l3)>lowest(l3)[1])<barssince(lowest(l3)<lowest(l3)[1])?1:0
w29=barssince(lowest(l4)>lowest(l4)[1])<barssince(lowest(l4)<lowest(l4)[1])?1:0
w30=barssince(lowest(l5)>lowest(l5)[1])<barssince(lowest(l5)<lowest(l5)[1])?1:0
//accumulation/distribution
w31=accdist>=accdist[l1]?1:0
w32=accdist>=accdist[l2]?1:0
w33=accdist>=accdist[l3]?1:0
w34=accdist>=accdist[l4]?1:0
w35=accdist>=accdist[l5]?1:0
//volatility stop
w36=src>highest(l3)-atr(l3)
w37=src>highest(l3)-2*atr(l3)
w38=src>highest(l3)-3*atr(l3)
w39=src>highest(l3)-4*atr(l3)
w40=src>highest(l3)-5*atr(l3)

wtot = w1+w2+w3+w4+w5+w6+w7+w8+w9+w10+w11+w12+w13+w14+w15+w16+w17+w18+w19+w20
wtotal=wtot+w21+w22+w23+w24+w25+w26+w27+w28+w29+w30+w31+w32+w33+w34+w35+w36+w37+w38+w39+w40
woe=100*wtotal/40
smwoe=ema(woe,ls)
hline(0,title='Zero', color=gray,linestyle=dotted, linewidth=1)
hline(50,title='Fifty', color=gray,linestyle=dotted, linewidth=1)
hline(100,title='Hundred', color=gray,linestyle=dotted, linewidth=1)
plot(woe,title='WoE',color=orange,style=columns)
plot(smwoe,title='Smoothing',style=line)