Volume Weighted Moving Average

411

The formula for the volume weighted (or volume adjusted) moving average is...

I have added the function vwma() to MetaTrader's Moving Averages.mq4 and called it myVWMA.mq4 (attached).

The difference between the VWMA and the SMA (simple moving average of the same period) is a measure of a trend's robustness.

If the difference is positive, it is called VPC+ (volume-price confirmation), if negative VPC- (volume-price contradiction).

You use that information in your trading by avoiding trends that are contradicted and mounting trends that are confirmed.

I am now trying to build an oscillator of VPC similar to MACD in appearance, but I need your help.

In building MACD, MetaTrader uses the function...

 double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)

but there is no ma_method called MODE_VWMA. How can I use the vwma() function to produce the info I need for the VPC oscillator?

Thank you all, Helmut

Files:
myvwma.mq4 7 kb
1316

I knew I should of being paying more attention in Calculus classes!

Ah hindsight (< 8)

It's to late right now, but I'll take a closer look at it later.

Thanks for posting this.

411

Found it, so simple using MACD.mq4 as a template (myVPC.mq4 is attached).

The rationale behind the VPC indicator is described in the attached article.

(It looks as though I can't upload VPCI.pdf 488 kb, you find it here... https://www.mta.org/eweb/docs/2007DowAward.pdf)

Thank you for your interest. If you use it, let me know how it goes. Helmut
Files:
myvpc_2.mq4 3 kb
411

I am now looking at the VPC indicator when I am trading.

Based on other signals, I am currently long. Got a couple of good candles already. The VPC is +.

The third candle made a good start but is now shrinking. However, the VPC+ is growing.

Where I might have viewed the shrinking candle with some trepidation before, the growing VPC+ gives some assurance that the long position is sound.

It's not over until the fat lady sings. I'll keep you posted.

411

The third candle ended up a perfect Doji, but the forth candle is currently going through the roof, with VPC+ still growing.
411

The fifth candle is struggling. VPC+ is growing slowly, may not get past the previous top.

Candle still positive, but was negative to start. This is tense! My trailing stop is in the money but a long way from the top.

The candle is turning negative and VPC+ has stopped growing. I am out with a nice profit. The next few candles will tell.

411

I hate to gloat, but on the next candle the market collapsed way past my trailing stop.

I would have still got out with a small profit, but this one example shows me that watching the VPC while trading has merit.

411

For the next five candles, the market went through the floor.

To fully appreciate these postings, you have to look at the time stamp.

476

I see my code is not useful Helmut, Have a great trade.
411

cameofx:
I see my code is not useful Helmut, Have a great trade.

Thank you, cameofx, it was useful, you shouldn't have deleted it.

However, the model of MetaTrader's MACD.mq4 was perfect for my task, so I used it.

The important thing is this - is the VPC indicator useful in trading?

The above one-trade example is a pointer, but one swallow doesn't make it spring.

If you would test the VPC in your trading as I shall in mine, maybe we can draw a conclusion.

As I said above, the rationale is given in this article... https://www.mta.org/eweb/docs/2007DowAward.pdf

Please let me know how you go? Sincerely, Helmut

411

Here is another opportunity. I get a buy signal from my other indicators but VPC is negative, so I stay out.

The first candle is up, slightly. I am not in the market even though all other indications are to go long.

This is a test of the VPC. Can I trust it as a filter to stay out when other signals say go in?

I am watching the candle. It is slightly positive but VPC- is growing negative. What a drama!

On each occasion, I am trading (or not trading) EURUSD M15, so we only have to wait 15 min to get a new bar.

Blow me down - the next bar starts out negative and VPC- is growing negatively. So much for my signals to go long.