Sunday 14 October 2012

VWAP: Problem With Colour Change

I been trying to post my Volume Weighted Average Price (VWAP) indicator, but I'm having a problem with the change over of colour when price closes above/below the VWAP line. Here is a picture of said problem:

VWAP,volume,moving average,MA
 You can see where the circles are that the red line should have disappeared as soon as the bar closed. But as it turns out the red line will stop moving in the direction of the price movement as soon as the price cross the line, and if the price remains above the line the red line will then cease to exist, and the blue line will take over.
So, the problem lies with the red line not moving with the price action even though the bar has yet to close.


This is my predicament. Hopefully I can come up with some sort of solution to the problem. But for now the posting of the VWAP indicator will be postponed.

Sunday 7 October 2012

Volume Weighted Average Price (VWAP): Colour Change

Just finished with another indicator I've been working on for MetaTrader 4: Volume Weighted Average Price (VWAP). I've seen this indicator around, so it is nothing new. The purpose for making a indicator that already exists is for practice with my coding skills. With this indicator I started from a formula posted on Wikipedia, and tried to code it, but ran into difficulties. I had to sum close and volume data AND split those summations into set periods. A little more difficult than my usual coding practices. But, none the less, I found a solution, and now I have a colour changing VWAP line on my charts:

I'm not posting the indicator on the Indicator portion of my site just yet. Still have some more bugs to work out.