How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Feature Request FAQ Help & Wiki Twitter

# MAC-Z VWAP Indicator [LazyBear]

2161 4
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:
Chart:

//
// @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)
Damn, dude. I need a separate folder in my favorite scripts just for yours. Thanks again.
grahvity
yw :)
Thanks, man! Would you recommend a good entry point for divergences?
cristian.d
Signalline-crossing after a divergence, followed by other confirmations like fib/SR bounce et al should be good, imo.
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia

한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter