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 open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?
//
// @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)