Volume-Weighted Macd Histogram
The article by David Hawkins in this issue, "Volume-Weighted Macd Histogram", has demonstrated how to make the Macd-histogram (Macdh) perform better by volume weighting it.
Using Indicator Builder, one needs to create the following indicators:
The volume-weighted moving average:
input
Period:"Enter number of periods",52, 1, 500;
end_input
var
Per0:=Period;
Vwma:= 0;
end_var
Vwma:= (CumSum(V * C, Per0) / CumSum(V, Per0));
return Vwma;
The volume-weighted exponential moving average:
input
Period:"Enter number of periods", 22, 1, 500;
end_input
var
Per0:=Period;
Vwema:=0;
end_var
Vwema:=(Mov(V * C, Per0, E)) / (Mov(V, Per0, E));
return Vwema;
The volume-weighted MACD histogram:
input
PeriodS:"Enter short period", 12, 1, 500;
PeriodL:"Enter long period", 26, 2, 501;
PeriodSig:"Enter smoothing period", 9, 1, 200;
end_input
var
PerS:=PeriodS;
PerL:=PeriodL;
PerSig:=PeriodSig;
LongMA:=0;
ShortMA:=0;
VMACD:=0;
SignalLine:=0;
end_var
LongMA:=(PerL * Mov(V * C, PerL, E)) /
(PerL * Mov(V, PerL, E));
ShortMA:=(PerS * Mov(V * C, PerS, E)) /
(PerS * Mov(V, PerS, E));
VMACD:=(ShortMA - LongMA);
SignalLine:=Mov(VMACD, PerSig, E);
return VMACD - SignalLine;
|