SteynTrade

Colored Volume Bars with Standard Deviation from the Mean

I have updated the indicator to help visualize volume . The percentage scale is based on a 21 period look back average . The colored volume bars represent volumes that exceed specified standard deviation of this 21 period average as indicated in the figure. The deviation bands are based on a the 55sma of the 21 period average (brown line). A 8 period sma of the 21 moving average (red line) is also indicated.

Script de código abierto

Siguiendo el verdadero espíritu de TradingView, el autor de este script lo ha publicado en código abierto, para que los traders puedan entenderlo y verificarlo. ¡Un hurra por el autor! Puede utilizarlo de forma gratuita, aunque si vuelve a utilizar este código en una publicación, debe cumplir con lo establecido en las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.

¿Quiere utilizar este script en un gráfico?
//
// @PVSA volume indicator -SteynTrade_v4
//
study("Colored Volume Bars with Standard Deviation from the Mean", shorttitle="Volume Deviation_V4")
lookback=input(21,minval=1, title="Time Frame Base")
showMA=input(true)
lengthMA=input(8,minval=1, title="Signal Ocsillation")
lengthband=input(55,minval=1, title="Base Oscillation")
hline(0, linewidth=1, color=black)
hline(100, title="100", color=green)
v1=volume
c1=close
o1=open

avvol=sum(v1, lookback)/lookback
pervol=(v1-avvol)/avvol*100
signal=sma(pervol, lengthMA)

vstd=stdev(pervol,lookback)

c=	iff(c1>o1 and pervol>(1.664 * vstd), green,
	iff(c1>o1 and pervol>(0.994*vstd), olive, 
	iff(c1<o1 and pervol>(1.644 * vstd), red,
	iff(c1<o1 and pervol>(0.994*vstd), orange, 
	iff(pervol<-(1.281*vstd),fuchsia, gray)))))

plot(pervol, style=histogram, color=c, linewidth=3)
plot(signal, style=line, color=red, linewidth=2)

ma=sma(pervol,lengthband)
offs=(1.644 * stdev(pervol, lengthband))
offs2=(0.994*stdev(pervol, lengthband))
up=ma+offs
up2=ma+offs2
dn=ma-offs2
dn2=ma-offs
mid=(up+dn2)/2
plot(showMA?up:na, color=black)
plot(showMA?dn:na, color=gray)
plot(showMA?ma:na, color=maroon)
plot(showMA?up2:na, color=gray)
plot(showMA?dn2:na, color=black)