SteynTrade

Colored Volume Bars standard deviation from mean

The colour bars:
Green: Price up - Volume > 2 x STD of last 21 bars
Blue: Price up - Volume > 1 x STD of last 21 bars
Maroon: Price down - Volume > 2 x STD of last 21 bars
Purple: Price down - Volume > 1 x STD of last 21 bars
Grey: not high volume bar
Green line: 2 bar sma
Red line: 8 period sma of the greenline
Bollinger band: 55 period sma of the 21 period sma with bands 1.618 deviation from the mean

Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
//
// @PVSA volume indicator -SteynTrade
//
study("Colored Volume Bars standard deviation from mean", shorttitle="Volume Deviation")
lookback=input(21)
showMA=input(true)
lengthMA1=input(2)
lengthMA2=input(8)
lengthband=input(55)

v1=volume
c1=close
o1=open

vsma1=sma(v1,lengthMA1)
vsma2=sma(vsma1,lengthMA2)
vsma3=sma(v1[lookback],lookback)
vstd=stdev(v1[lookback],lookback)

c=	iff(c1>o1 and v1>(vsma3+(2 * vstd)), green,
	iff(c1>o1 and v1>(vsma3+vstd), blue, 
	iff(c1<o1 and v1>(vsma3+(2 * vstd)), maroon,
	iff(c1<o1 and v1>(vsma3+vstd), purple, gray))))
plot(v1, style=columns, color=c)
plot(vsma1, style=line, color=green)
plot(vsma2, style=line, color=red, linewidth=2)


ma=sma(vsma1,lengthband)
offs=(1.618 * stdev(vsma1, lengthband))
up=ma+offs
dn=ma-offs
mid=(up+dn)/2
plot(showMA?up:na, color=black)
plot(showMA?dn:na, color=black)
plot(showMA?mid:na, color=blue, linewidth =2)