Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I'm confused by "forum VWAP". Is this a NT-staff written indicator or an included out of the box indicator? If yes, why not notify @NinjaTrader so they can correct it or remove it? It's not on futures.io (formerly BMT) right?
If it's a user contributed study then probably all you can do is leave negative feedback/rating on it to warn others it is not accurate, or perhaps ask NT to edit the description of the indicator if they don't have a rating system implemented to warn people.
@Big Mike: Many of the indicators published on all forums have bugs. The VWAP on the NinjaTrader forum has a few more bugs, as it both produces false results and easily kills the CPU with COBC set to false. Use it at your own risk.
There are already various threads on the NinjaTrader forum, where the bugs of this indicator have been discussed. One of the guys has even modified it and published a new version called hVWAP. This is one has some of the problems addressed. No reason to call Ray. Otherwise you would need to call him every day.
To be honest ... the plot of my newly published SessionPivots also has bugs, and I will have to replace it tomorrow. The CPU efficiency of the relative volume indicator that I have coded some time ago, is comparable to the NinjaTrader VWAP as well. I will have to rework it, but time is the limiting factor, so I let it temporarily go.
VWAPs are particularly difficult to code. I have now scanned the available algorithms and will settle for a weighted incremental algorithm, which will further increase accuracy and reduce CPU load by a factor 5 or 10. This is still work in progress, and as long as I have not finished it, you will have to live with the anaCurrentDayVWAP, which is already good, but certainly not good enough.
So far I have only used one data point per bar to calculate the variance, and this has also proved to be insufficient. The error term mostly affects the RTH VWAP because it starts at full speed with the first bar after the regular open and is more sensitive to incomplete information. This what can be done:
-> replace one data points with all 4 points of a bar (open, high, low & close) both for calculating the VWAP and for calculating the variance
-> give a higher weight to open and close compared to high and low in order to simulate an intrabar price volume distribution
-> redesign algorithm to gain speed and reduce numerical instability, overflow and rounding errors due to internal representation of numbers
I am not a great mathematician, so far I had ignored the existence of a few things such as Steiner's translation theorem. I guess I should have read
Donald E.Knuth: The Art of Computer Programming, Vol 2 - Seminumerical Algorithms
long time ago, but I didn't. I finally found what I have looked for, a numerically stable and fast algorithm, see formula (2.1b) of the paper attached below.
Selecting an appropriate algorithm for the variance of the VWAP is not the easiest task, unless you have graduated in computer science or mathematics. Let the VWAPs be what they are, as long as the colors are acceptable!
The pretty bad performance of the forum VWAP has lead me to a detailed analysis of my own VWAP, the anaCurrentDayVWAP, and I must say that it is also inaccurate and too slow.
The main problem of all VWAPs so far was the limiation imposed by selecting a single data point per bar to perform calculations. This is of course utterly stupid. A price bar contains more information than just the close or an average price. A price bar contains 5 values, the open, the high, the low, the close and the volume. The four values containing price data are just an approximation for a price volume distribution. For the purpose of calculating the VWAP and the standard deviation, I will now use all 4 of them. However, high and low are at the end of the volume distribution, so a smaller weight should be applied compared to the open and the close. As a first approximation I used a factor 2 for the open and the close, but 1 for high and low.
The next improvement is the use of a numerically stable (with respect to rounding and overflow errors) weighted incremental algorithm. I will report the details in a separate thread.
The results are do far astonishing with respect to both accuracy and speed. Below is attached a screenshot of the redesigned VWAP. The green bands are calculated by using the newly developed algorithm, the blue bands stem from the original algorithm. You can see that there is a noteworthy difference. The green bands are both more accurate and smoother than the old bands.
The same concept can be applied to Bollinger Bands, which are inherently flawed for many reasons.