Hi - Can someone tell me how to change the MACD settings to make them Volume Weighted moving averages instead of exponential? I am using MC 6.1.
Thanks for the help.
Cheers
Volume Weighted MACD
- TJ
- Posts: 7751
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2228 times
Re: Volume Weighted MACD
Do you have the formula for Volume Weighted moving average?Hi - Can someone tell me how to change the MACD settings to make them Volume Weighted moving averages instead of exponential? I am using MC 6.1.
Thanks for the help.
Cheers
Re: Volume Weighted MACD
Hi - I found this code on the web but can't get it to compile without errors;
Code: Select all
//Indicator: VW_MACD
inputs:
FastLength( 12 ),
SlowLength( 26 ),
VW_MACDLength( 9 ),
DisplayVW_MACD( False ) ;
variables:
MyVolume( 0 ),
VW_MACD( 0 ),
VW_MACDAvg( 0 ),
VW_MACDDiff( 0 ) ;
if BarType >= 2 and BarType < 5 then
{ not tick/minute data nor an advanced chart type (Kagi, Renko, Kase etc.) }
MyVolume = Volume
else
{ if tick/minute data or an advanced chart type; in the case of minute data,
also set the "For volume, use:" field in the Format Symbol dialog to Trade Vol or
Tick Count, as desired; when using advanced chart types, Ticks returns volume if
the chart is built from 1-tick interval data }
MyVolume = Ticks ;
VW_MACD = ( XAverage( MyVolume * Close , FastLength )
/ XAverage( MyVolume, FastLength ) )
- (XAverage( MyVolume * Close , SlowLength )
/ XAverage( MyVolume, SlowLength)) ;
VW_MACDAvg = Average( VW_MACD, VW_MACDLength ) ;
VW_MACDDiff = VW_MACD - VW_MACDAvg ;
if DisplayVW_MACD then
begin
Plot1( VW_MACD, "MACD" ) ;
Plot2( VW_MACDAvg, "MACDAvg" ) ;
end ;
Plot3( VW_MACDDiff, "MACDDiff" ) ;
Plot4( 0, "ZeroLine" ) ;
Code: Select all
//Strategy: MACD_Diff
inputs: FastLength( 12 ), SlowLength( 26 ), MACDLength( 9 ) ;
variables: MyMACD( 0 ), MACDAvg( 0 ), MACDDiff( 0 ) ;
MyMACD = MACD( Close, FastLength, SlowLength ) ;
MACDAvg = XAverage( MyMACD, MACDLength ) ;
MACDDiff = MyMACD - MACDAvg ;
Plot1( MACDDiff, "MACDDiff" ) ;
Plot2( 0, "ZeroLine" ) ;
-
- Posts: 742
- Joined: 09 Apr 2010
- Location: Texas
- Has thanked: 483 times
- Been thanked: 274 times
- Contact:
Re: Volume Weighted MACD
It won't compile as is, because a strategy is in there too- I commented it out and it compiles..
- TJ
- Posts: 7751
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2228 times
Re: Volume Weighted MACD
1. In the future, please use the code tag to wrap around the code. It makes reading the code easier. (I have done it for you this time.)Hi - I found this code on the web but can't get it to compile without errors;
...
2. In the future, please copy and paste the error message, so that people know where to help you. Sometimes the error has nothing with the code, but your computer, or other issues.
ps. there are 2 codes in your post.
Re: Volume Weighted MACD
Thanks a lot guys. Will do no problem. Appreciate you pointing me in the right direction I am a coding dummy.
Cheers
Cheers
- TJ
- Posts: 7751
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2228 times
Re: Volume Weighted MACD
You are welcome.Thanks a lot guys. Will do no problem. Appreciate you pointing me in the right direction I am a coding dummy.
Cheers