LazyBear

MAC-Z VWAP Indicator [LazyBear]

This a modified MAC-Z using Z-VWAP. Since this uses VWAP, the signals are derived indirectly from both volume and price action.

I have also included a way to smooth MACZ-VWAP, you can enable it via options page.

Note that this will not work on any FX pair, as volume is not available.

Referenced indicators:
Z-distance from VWAP: MAC-Z Indicator: Z-Score:
Complete list of my indicators:
GDoc: docs.google.com...ByMEvm5MLo/edit?usp=sharin...
Chart:

List of my free indicators: bit.ly/1LQaPK8
List of my indicators at Appstore: blog.tradingview.com/?p=970
สคริปต์โอเพนซอร์ซ

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?
//
// @author LazyBear 
// List of all my indicators: https://www.tradingview.com/v/4IneGo8h/
//
study("MAC-Z VWAP Indicator [LazyBear]", shorttitle="MACZVWAP_LB")
fastLength = input(12, minval=1, title="MACD Fast MA Length"), slowLength=input(25,minval=1, title="MACD Slow MA Length")
signalLength=input(9, title="MACD Signal Length")
lengthz = input(20, title="Z-VWAP Length")
lengthStdev=input(25, title="Stdev Length")
A=input(1.0, minval=-2.0, maxval=2.0, title="MACZ constant A")
B=input(1.0, minval=-2.0, maxval=2.0, title="MACZ constant B")
useLag=input(false, type=bool, title="Apply Laguerre Smoothing")
gamma = input(0.02, title="Laguerre Gamma")
source = close

calc_laguerre(s,g) =>
    l0 = (1 - g)*s+g*nz(l0[1])
    l1 = -g*l0+nz(l0[1])+g*nz(l1[1])
    l2 = -g*l1+nz(l1[1])+g*nz(l2[1])
    l3 = -g*l2+nz(l2[1])+g*nz(l3[1])
    (l0 + 2*l1 + 2*l2 + l3)/6


calc_zvwap(pds) =>
	mean = sum(volume*close,pds)/sum(volume,pds)
	vwapsd = sqrt(sma(pow(close-mean, 2), pds) )
	(close-mean)/vwapsd

zscore = calc_zvwap(lengthz)
fastMA = sma(source, fastLength)
slowMA = sma(source, slowLength)
macd = fastMA - slowMA
macz_t=zscore*A+ macd/stdev(source, lengthStdev)*B
macz=useLag ? calc_laguerre(macz_t,gamma) : macz_t
signal=sma(macz, signalLength)
hist=macz-signal

plot(hist, color=red, style=area, title="Histogram", transp=85)
plot(macz, color=green, title="MAC-Z", linewidth=2)
plot(signal, color=orange, title="Signal", linewidth=2)