Trouble calculating the VWAP of each bar in a chart - EasyLanguage Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation > EasyLanguage Programming

Trouble calculating the VWAP of each bar in a chart
Started:September 15th, 2011 (04:51 PM) by chisound Views / Replies:1,634 / 3
Last Reply:October 3rd, 2011 (04:52 AM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Trouble calculating the VWAP of each bar in a chart

Old September 15th, 2011, 04:51 PM   #1 (permalink)
Elite Member
Chicago, IL USA
Futures Experience: Advanced
Platform: Multicharts
Broker/Data: TT and IQFeed
Favorite Futures: ES
Posts: 6 since Apr 2010
Thanks: 3 given, 4 received

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:

    intrabarpersist PriceW(0),
    intrabarpersist ShareW(0),

If barstatus = 0 then begin    
    PriceW = 0;
    ShareW = 0;
PriceW = PriceW + (Close * (Ticks));
ShareW = ShareW + (Ticks);
PriceX = PriceW;
ShareX = ShareW;
If ShareX > 0 then IntrabarVWAP = PriceX / ShareX; 

Many thanks for your help with this.

Reply With Quote

Old September 15th, 2011, 04:51 PM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Old October 2nd, 2011, 03:33 AM   #3 (permalink)
Site Administrator
Manta, Ecuador
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
Big Mike's Avatar
Posts: 45,432 since Jun 2009
Thanks: 28,836 given, 79,560 received

You might check here:


Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following 2 users say Thank You to Big Mike for this post:

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > TradeStation > EasyLanguage Programming > Trouble calculating the VWAP of each bar in a chart

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart Bar with volume indicator inside Bar? hector24 NinjaTrader 11 October 9th, 2011 10:41 AM
Sierra Chart and custom bar types Big Mike Sierra Chart 34 January 12th, 2011 10:09 AM
chart stocks with vwap ciardim Brokers and Data Feeds 2 August 23rd, 2010 11:36 AM
Variable Bar Chart DavidHP Traders Hideout 0 December 4th, 2009 03:53 PM
Volume Chart Bar Size Setting??? RJay Traders Hideout 5 September 1st, 2009 10:32 PM

All times are GMT -4. The time now is 04:44 PM.

Copyright © 2016 by All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts

Page generated 2016-10-23 in 0.10 seconds with 20 queries on phoenix via your IP