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)
Trouble calculating the VWAP of each bar in a chart
I am attempting to calculate the internal VWAP for each bar in a chart as opposed to what is normally done when calculating VWAP, ie calculate the VWAP of a day as of the close of the last bar. So for each tick in a bar after and including the first tick of the bar i need to keep two counters going, one to keep a sum of Price of tick * volume of tick for the bar and the other to sum the volume of each tick for the bar. At the end of each bar i then calculate the internal VWAP of the bar that just closed using the following:
IntrabarVWAP = Bar Sum of (Price of tick * volume of tick ) / ( Sum of volume of ticks)
I then need to reset the two sum counters to 0 so that the internal VWAP for the next bar can be calculated independently.
Seems simple enough but this is a real headache. I either get the Internal VWAP of each bar to equal the Close of each bar, which is not possible or i get it to be a number that is outside of the range of each bar, which is also not possible.
I am using Multicharts 7.0 and have "Update on every tick" disabled for the indicator as i am using intrabarpersist . I have tried using Range Bars, minute bars (built from ticks) and tick bars all with the same results.
Here is the code i am using:
Many thanks for your help with this.
Can you help answer these questions from other members on NexusFi?
Does anyone have a quarterly and/or weekly VWAP indicator for easy language? I've been trying to look at long range views for some stocks and commodities and how it relates to daily movements with respect to the longer VWAP.