MACZVWAP

Category: Indicators By: Nicolas Created: May 10, 2022, 9:25 AM
May 10, 2022, 9:25 AM
Indicators
4 Comments

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.

Referenced indicators:
Z-distance from VWAP

(description from original author: Lazybear).

Note that this will work only on instrument with Volumes

//PRC_MACZVWAP | indicator
//10.05.2022
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//converted from pinescript

// --- settings
fastLength = 12 //MACD Fast MA Length
slowLength = 25 //MACD Slow MA Length
signalLength = 9 //MACD Signal Length
lengthz = 20 //Z-VWAP Length
lengthStdev = 25 //Stdev Length
A = 1.0 //MACZ constant A
B = 1.0 //MACZ constant B
useLag = 1 //Apply Laguerre Smoothing (0=false ; 1=true)
gamma = 0.02 //Laguerre Gamma
// --- end of settings 

source=customclose

mean = summation[lengthz](volume*close)/summation[lengthz](volume)
vwapsd = sqrt(average[lengthz](pow(close-mean, 2)))
zscore = (close-mean)/vwapsd

fastMA = average[fastLength](source)
slowMA = average[slowLength](source)
imacd = fastMA - slowMA
maczt=zscore*A+ imacd/std[lengthStdev](source)*B
if uselag and maczt>0 then 
s = maczt
g = gamma 
l0 = (1 - g)*s+g*(l0[1])
l1 = -g*l0+(l0[1])+g*(l1[1])
l2 = -g*l1+(l1[1])+g*(l2[1])
l3 = -g*l2+(l2[1])+g*(l3[1])
macz=(l0 + 2*l1 + 2*l2 + l3)/6
else
macz=maczt
endif 
signal = average[signalLength](macz)*50
hist=macz-signal

return hist coloured("red",85) style(histogram),macz coloured("green") style(line,2),signal style(line,3), 80 style(dottedline2,2) coloured("red"), -80 style(dottedline2,2) coloured("lime")

Download
Filename: PRC_MACZVWAP.itf
Downloads: 299
Nicolas Master
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Logo Logo
Loading...