I've noticed a small but significant issue with anaCurrentDayVWAPV38. If I compare it to GomMP VWAP, it generally produces the same result, however, it seems to draw it slightly off so that price action doesn't exactly respect the visual level. The following are not isolated incidents but rather occur often, albeit at a small level.

Note the prices are the same, but the visual levels are not.

Another example:

Can anything be done to fix this small discrepancy. Otherwise, sometimes it appears that price has crossed the anaVWAP when it hasn't or vice versa.

Learn The Rules Well So You Can Break Them Effectively

How did you conclude that the anaCurrentDayVWAP is slightly off and not the GomMPVWAP?

If you are within the session and price action continues, the VWAP cannot be a horizontal line, but it must follow price action. That is if prices are above the VWAP, the VWAP should rise and if prices are below the VWAP, the VWAP should fall. In any case it cannot be stable during the session.

Depending on the data used for calculating a VWAP there can be a slight inaccuracy. The correct VWAP can only be calculated from tick-by-tick data by using every single trade. The anaCurrentDayVWAP38 uses an approximation for calculating the average price, as it cannot access the 1-tick data series, but only the bars on the chart. I do not know what type of bars you use, because you have not shown it. But whatever it is, it is used. The best available approximation for the VWAP of a bar is (high + low + open + close) / 4. The indicator then collects the VWAPs of all bars and calculates the average price for the session. On larger timeframes, such as 15 or 60 min bars, anaCurrentDayVWAP may be 1 or 2 ticks off, because the necessary price and volume information to calculate a 100% accurate VWAP is not available with the bar series.

That price respects the visual level of the GomMPVWAP is just an illusion. But if you need that illusion, this is the way to go:

-> round the VWAP to the tick (needs a slight modification of the indicator code)
-> set the Plot Style of the VWAP plot to square and you will see a step function as for the other one

The following user says Thank You to Fat Tails for this post:

I was not saying that your calculations are wrong, in fact, considering they are only being done bar by bar instead of tick by tick like Gomi's VWAP, they are amazingly accurate.

I thought maybe there was a NinjaTrader rendering issue. It looked like NinjaTrader was rendering your VWAP line at one edge of a price point's pixel range instead of in the middle, making it appear slightly off vis-a-vis price action. I thought Gomi's VWAP didn't have the same problem maybe because it has its own rendering engine.

However, the instructions you posted explain the issue. Additionally, you have correctly pointed out that the color of the VWAP line provides the proper guidance as to whether price is above or below it.

Thanks for your response and your work!

Learn The Rules Well So You Can Break Them Effectively

Looks pretty much like a perfect match. Amazing. Even though this was a small change, I do think it certainly improves the usability of the indicator, not only the VWAP, but the bands as well, thanks again

Learn The Rules Well So You Can Break Them Effectively

The following user says Thank You to srgtroy for this post:

I'm looking for a 3 day vwap. Would any programmers be able to convert ana38 to a three day version and could anybody tell me whether Gomi's MP will plot a three day vwap? Thanks

What do you need a 3-day VWAP for. Do you want a rolling 3-day VWAP or a 3-day VWAP that resets at the beginning of the session. This is the difference:

Rolling 3-day VWAP: Takes into account the last 72 hours of trades. Adds continuously new trades and subtracts trades prior to the period of 72 hours.

3-day VWAP: Starts at the beginning of the session with the volume weighted average price of the preceding 2 days and then adds the trades of the current day. After the end of the day it restarts with a gap.

I have not coded that so far. You can display the VWAP of the two or three prior sessions via the SessionPivotsRolling indicator, but then that VWAP will remain fixed, without further trades added during the day.

Or just trade on Wednesday's. Then you can use the weekly VWAP.

You are selling the n period vwap for 250$, a lot of money. Another indicator salesman I talked to says it will cost 450$ to modify the ana38 session indicator to a three session indicator. Looks like I may be in the wrong business. Are there any coders out there who can do it for less?

Hi there, the issue is the use of tick file data v bid ask data. To illustrate the first chart shows the ana monthly vwap using bidask (file) setting in GOMmp from 1 May. You can see the ana vwap and gomi is a little bit off.

If you look at the second chart showing GOMmp with data source as tickdata, you can see it matches exactly.

It would appear Gomi vwap is superior to anavwap. I also have problems with anapivots as they don't match up with the majority of pivot calculations published by research companies or as found natively on high end platforms. Ana indicators seem to be rather lacking in both accuracy and precision. I think I will move on to more professional tools.

Hi, I think that's a bit harsh. My experience has been a little bit different whereby the ana indicators have been superior to most I have tried in respect of accuracy and load times. The problem with pivots is there are many different variations of the way they are calculated.

The vwap issue is not the fault of the ana indicator but the fact that it is using a different data source. I'm currently testing the monthly anavwap and the Gomvwap on sim in market replay on a large swing timeframe. I'm not too concerned with the differences.

I think on a daily chart the difference would be immaterial using bidask v tickdata.

ANA indicators are just free bait anyways, an enticement to lure the unsuspecting outside the forum where the creator puts on his indicator saleman hat and extracts exorbitant prices for the real ones. Anybody want to drop 500$ for a fib confluence indicator, lmao...

@syxforex: I am not selling the n period VWAP for 250$ and I am not an indicator salesman, although I plan to create a website. I have coded a few high performance indicators for my own needs, which I share with those who want them. I have also coded free versions of daily, weekly VWAPs and TWAPs. The SessionPivots and SessionPivotsRolling indicators display the VWAP of the prior and the prior N days. All for free. The free VWAPs, which I have put into the download section already use a recursive algorithm for calculating the SD bands, which makes them much faster than other VWAPs available (such as the hVWAP or the flawed VWAP from the NinjaTrader forum).

The indicator you were talking about, uses a secondary 1-minute bar series and only recalculates once per minute. The CPU load is such that you can put a bunch of 50 of them on a market analyzer for all the instruments you want to monitor and get your alerts in real time, when the SD bands are hit. Do you know how much time it takes to code and test that stuff?

I believe that I have the right to decide what I give away for free, and that you should not complain about somebody else asking money to work for you. That said $ 450 to modify the anaCurrentDayVWAPV38 indicator is expensive, if you need some help, you can contact me via private message.

Basically to achieve what you want, you would just need to collect the final values of the variables that are summed up for the prior N days at the end of each trading day, and then use them to calculate the n-day VWAP and SD bands. Not an easy work, in particular not if you want to take into account the holiday sessions. So even for me it would be a few hours of work to get it right.

@syxforex: If you are frustrated with your life and your trading experience, it will not help you to bash my indicators. They are good enough to speak for themselves. And if the anaCurrentDayVWAP38 is so bad, why did you want to use it as a base for your N-day pivots? You could have chosen another one.

You are right, if you state that the anaCurrentDayVWAP maybe a few ticks off, if it is running on a larger timeframe chart. This depends on the resolution of the bars which are used to calculate the VWAP. The intrabar distribution is not known for a 60 minute bar, and the accuracy is limited. You would need to load a secondary bar series to have higher accuracy on larger timeframe charts. On a 1 min chart the anaCurrentDayVWAP is accurate to the tick.

As to the pivots, you probably don't understand how to use them. The values do match the values of professional websites, provided you use the pivots as explained in this thread.

I am getting quite a number of messages and mails, how to configure the various pivot indicators, so I decided to post a brief summary and explain via a few examples, how to draw the pivots where you want them. I attach the SessionPivots indicators for …

Fair enough with what you have written here, but to be sure, I think you are an indicator salesman, and I have emails from you that I am happy to publish here wherein on multiple occasions you have quoted me 250$ for the n period vwap. I have no problem with your current business model whatsoever and I wish you all the luck with your new online indicator store.

Fat Tails recently finished a indicator for me. He took a badly coded sine wave and created a quick smooth greatly expanded new indi. He probably took a lot more time to do this but still stayed with his original price quote. Thanks Fat Tails .....money well spent.

The following user says Thank You to jocomoco for this post:

Any of Fat Tails published basic concepts is free for download... any users with own programming experience can modify this self for add any needed features.
Its is normal, when a developer in continue make his work faster and better by using other internal concepts. This is dont need to publish... this is don't needed, while any results comperable with the basic concept... its only nice to have.

The other point is: make any additions on request. Here is the time for do this the value, not the work self!
I see no problem with a offer for customize a free basic tool and/or give access to advantage internal funtions for better use/realize the requested functionality.

=> Change the free code self or use a "time" offer from any interested developer. Its a simple deal and NOT a VENDOR BUSINESS.

The following user says Thank You to TimeTrade for this post:

The discussion does not belong into this thread, I will not answer in detail. Just two comments. I have indeed sold a package of 8 high performance VWAPs to a few other traders for $ 250 (I am using these indicators for my own trading, have spent about a month to code them). My quote to you was for 8 indicators as you asked for it. Furthermore, I have repeatedly recommended to you not to purchase any expensive indicators, as it will not improve your trading. I have even explained to you, how you can achieve comparable results by using free indicators.

And now:

The following user says Thank You to Fat Tails for this post:

And there is the truth Fat Tails, I am a trader, whereas you only claim to be. I am quite sure that you are but an indicator salesman, only. Though I don't profess to read across space and time like you your indicator greatness. For all the money you leach off the good people here on this site I am always shocked by your level of arrogance and disrespect for them.

Site Administrator Swing Trader Data Scientist & DevOps

Manta, Ecuador

Experience: Advanced

Platform: My own custom solution

Trading: Emini Futures

Posts: 49,745 since Jun 2009

Thanks: 32,292 given,
97,494
received

I lift bans early for good behavior (ie: not creating duplicate accounts to get around the ban, not emailing me and cussing me out and telling me how it was the biggest mistake of my life to ban the user, etc).

Not sure if this is an issue or not, but if both anaCurrentDayVWAP40 and NT default VWAP are plotted, different results are seen which are obvious at the beginning but then converge at the end of the session.

I can assume this might be due to the session hours used in both indicators. I believe from the parameter list the default NT VWAP uses a full 24 hrs.

Could you confirm this please. If that is the case Ninja has done a poor job in this regard.

@aligator: This is a difficult question, because there are several answers. We need to make a distinction between the VWAP and the bands.

First of all, the VWAP is not a NinjaTrader default indicator, but was published on the NinjaTrader forum. Also the deviation that you observed is not linked to the selected session, as on your chart, both VWAPs start at the same time.

VWAP formula: There is only one accurate value for the VWAP. You get it, if you calculate the volume-weighted average price of all transactions. You can calculate the exact value by applying the VWAP indicator to a 1-Tick chart. If you apply the VWAP to a 2000-Tick chart, then you neeed to make an approximation, as you do not have the prices of all transactions within each 2000-Tick bar available.

For the purpose of calculating the average price, the forum VWAP attaches the entire volume of the bar to the close. This is obviously a bad approximation. The anaCurrentDayVWAP uses (Open +High +Low +Close)/4 instead of the close, which is much more accurate. I have attached a chart below with yesterday's price action for the ES 06-13. The anaCurrentDayVWAP is displayed blue & red, where the forum VWAP has green & orange colors. At (2) you can notice that the orange forum VWAP deviates to the upside, because it attaches the volume of the two green bars to the close, while the anaCurrentDayVWAP has the better approximation.

Standard deviation bands: The anaCurrentDayVWAP uses two different formulae, the formula Variance_Last, which follows the classical definition of the standard deviation of data points, and the formula Variance_Distance, which in fact is based on the variance of the distance of all data points from the VWAP around the value 0, and not on the variance of the data points around the mean. The Variance_Distance formula is a recursive formula, which is fast to calculate and which gives a good approximation of the orthodox Variance_Last formula, once you are one or two hours into the session. The anaCurrentDayVWAP can also calculate bands according to a third formula, which is based on the session range and which is also available in other charting packages.

If you want to compare the SD bands plotted by the anaCurrentDayVWAP to the SD bands plotted by the forum VWAP, you need to set anaCurrentDayVWAP to Variance_Last, such that both of them use the same approach. If we look at yesterday's chart again, you will find two noteworthy differences. At (1) the forum VWAP starts the day with a beak. The standard deviation is calculated as zero for the first bar, because the indicator compares the close to the close. This is obviously incorrect. It is not a big problem for an ETH VWAP, as the volume of the first bar of the night session is rather low. But it can be a problem for the RTH VWAP, as the volume of the first bar of the regular session is pretty high. At (2) you will notice that the SD bands of the forum VWAP show approximately the same error as the VWAP itself.

The chart below shows the full problem for the VWAP calculated for the RTH session.
Both indicators are set to COBC = true. The values do not match at all.

When set to COBC = false, the forum VWAP calculates different values for the VWAP and the SD bands.
This means that it changes its values, if you refresh the chart via F5, see below:

The following 6 users say Thank You to Fat Tails for this post:

By the way, here is another example, how erroneous the calculations of the VWAP from the NinjaTrader forum are sometimes.

The chart shows the price action of 6B 03-13 for yesterday's regular session. You will notice that quite a few price bars closed outside the 3rd SD band during the morning. This is impossible!

For a Gaussian distribution only about 0.27% per cent of the data points should be outside the 3SD band. The regular session is made up of 400 1-minute bars. Applying the 0.27% rule I would expect one single bar out of 400 to close outside the 3SD band. However on this chart over 10% of all bars close outside the 3SD band!

This indicator is absolute crap. Just in case that you had any doubts.

If you look at the correct picture, there is one bar that close 5 ticks above the 3SD band, but none that close outside.

The following 7 users say Thank You to Fat Tails for this post:

Great explanation. I did compare the two again using the typical price for Forum VWAP just for curiosity, knowing will not get a match. And for sure there is no match.

Conclusion: The forum vwap needs some work or is to be ditched.

Site Administrator Swing Trader Data Scientist & DevOps

Manta, Ecuador

Experience: Advanced

Platform: My own custom solution

Trading: Emini Futures

Posts: 49,745 since Jun 2009

Thanks: 32,292 given,
97,494
received

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 following 5 users say Thank You to Fat Tails for this post:

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.

The following 9 users say Thank You to Fat Tails for this post: