Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

dbntina

VWAP Indicator with 1SD and 2SD bands

Recommended Posts

Hi there,

 

See your PM's. Am travelling at the moment but the current work is complete however I now want to incorporate multi day stuff and a histogram. The stuff that DBNTina is absolutely fine btw it ust cane be a little sluggish loading up...results are pretty much the same. That should do as a stopgap.

 

Cheers,

Nick

Share this post


Link to post
Share on other sites
Does anyone know whether the VWAP indicator downloadable from this thread is almost 100% accurate? Or does it need further adjustments?

 

Thanks.

 

Its 100% accurate on tick charts. To be honest on 2 minute charts its fine too. Its actually the PvP that can change characteristics on 2 minute bars. Dbntina posted an indicator that gets round that by using ADE to take data from a tick chart and push it to an X minute chart.

 

Cheers.

Share this post


Link to post
Share on other sites
add a 3rd SD, as this is the way Jerry teaches it? Bryan

 

Please find below in the code box the complete code listing for Jay who asked for it in August and for Bryan, just add the last three lines of this listing to the bottom of your indicator code:

 

input : trdSD (3);

Plot6(VolWAPValue + (trdSD*VolWAPSD), "VWAP3SDUp");

Plot7(VolWAPValue - (trdSD*VolWAPSD), "VWAP3SDDown");

 

The third SD is now an input, allowing you to use different numbers. There is nothing magical about '3'; it all depends on how many are following it and how strong the trend. Sometimes 2.5 works better.

attachment.php?attachmentid=4591&stc=1&d=1198255005


{***********************************************************************************************

Coded by dbntina/boxmeister 8/2/2007

Used the VWAP_H code provided by Tradestation on 02/07/2003 Topic ID = 6735 Thanks Guys!

Added the computation for variance and the Standard Deviation to combine into one indicator
plot and this indicator plots the VWAP, SD1 bands and SD2 bands

***********************************************************************************************}



[LegacyColorValue = true];

vars:
	PriceW(0),
	ShareW(0),
	Count(0),
	VolWAPValue(0),
	VolWAPVariance(0),
	VolWAPSD(0);


if date > date[1] then begin
	PriceW = 0;
	ShareW = 0;
	Count = -1;
	Value1 = 0;
	Value2 = 0;
	VolWAPValue = 0;
end;

PriceW = PriceW + (AvgPrice * (UpTicks+DownTicks));
ShareW = ShareW + (UpTicks+DownTicks);
Count = Count + 1;
Value3 = 0;

if ShareW > 0 then VolWAPValue = PriceW / ShareW;

{Calculate the individual variance terms for each intraday bar starting with the current
bar and looping back through each bar to the start bar.  The terms are each normalized
according to the Variance formula for each level of volume at each price bar			}

	For Value1 = 0 To Count Begin
	Value2 = ((UpTicks[Value1]+DownTicks[Value1])/ShareW) * (Square(AvgPrice[Value1]-VolWAPValue));
	Value3 = Value3 + Value2;
End;

VolWAPVariance = Value3;
VolWAPSD = SquareRoot(VolWAPVariance);


Plot1(VolWAPValue, "VWAP");
Plot2(VolWAPValue + VolWAPSD, "VWAP1SDUp");
   Plot3(VolWAPValue - VolWAPSD, "VWAP1SDDown");
Plot4(VolWAPValue + (2*VolWAPSD), "VWAP2SDUp");
   Plot5(VolWAPValue - (2*VolWAPSD), "VWAP2SDDown");
// added by request http://www.traderslaboratory.com/forums/f46/vwap-indicator-with-1sd-and-2sd-2175.html#post27273
input : trdSD (3);
   Plot6(VolWAPValue + (trdSD*VolWAPSD), "VWAP3SDUp");
   Plot7(VolWAPValue - (trdSD*VolWAPSD), "VWAP3SDDown");


5aa70e2e9ab98_vwapsd2.52007-12-21_113611.png.baeff4533d6cc6078c25fe28a779dae8.png

Share this post


Link to post
Share on other sites

I am using the 3 SD version updated by thrunner. There is one problem. When I add a Horizontal line like in the included picture, the price as listed on the horizontal line is incorrect. This problem only occurs on charts with the VWAP indicator. Notice that the HL is listed at 1508.91 while it is actually at the 1510.00 level.

 

Any thoughts on this?

 

ScreenShot001.thumb.png.3df23059753c590f29a1e3f3ae9464bc.png

Share this post


Link to post
Share on other sites
problem only occurs on charts with the VWAP indicator. Notice that the HL is listed at 1508.91 while it is actually at the 1510.00 level
Does this horizontal line problem persist after you move it up and down the vertical axis and/or right click format it? I do not see this problem in TS 8.2.3896. Which TS version are your using? There are some reports of inaccurate HL and alerts in prior versions of TS, but not recently. You may have to save a minimal chart and workspace with the problem and report it to TS support.

5aa70e2f7f761_dbvwaphorizontallineTS8.22007-12-27_085836.png.7ecff833c5d6c1d7abedff573f906639.png

Share this post


Link to post
Share on other sites

Thanks for the great indicator!

 

I tried it with the daily charts it it looks very weird and does not appear to work.

 

Can someone try it and see if they get this problem as well?

 

Also, it looks a bit different from the Ensign data that I got for today's trading (JAN 4 - 08)

 

Namely, Ensign hung around VWAP -std2, but with TS it hung around -std1 and it never touched std2.

Share this post


Link to post
Share on other sites

Thanks for the VWAP indicator for TS guys. I've been looking for this for a while and stumbled on this great thread. I have some issues though....

 

I have used the TS VWAP indicator posted here and I have seem some descrepencies between it and the VWAP indicator for Ensign (build in 03-Jan-08 version).

 

Namely, they don't seem to match. See the attached images for trading TODAY (Jan-04). Ensign has most of todays trading at -2std, while TS has it at -1std.

 

Also, the TS indicator does not seem to work for intervals other intraday. I tried to recreate someone else's chart for daily's on and it seemed to fail.

5aa70e3030b94_ensign-jan04vwap.thumb.PNG.9840278763623263040c3cabf4636e40.PNG

ts-vwap-jan04.thumb.PNG.0694590f38b2787c766e9ed908107499.PNG

ts-vwap-daily.thumb.PNG.23bbf5b904c60ed76be32f3902f25edc.PNG

Edited by lj2500
add more info...

Share this post


Link to post
Share on other sites
some descrepencies..... and it seemed to fail.
Welcome to the forum. As you have noticed, VWAP is a moving average and it's calculation can differ greatly depending on when (exact time) you started counting the VWAP, which defined as:
VWAP (Volume Weighted Average Price) is a measure of the price at which the majority of a given day's trading in a given security took place. It is calculated by adding the dollars traded for the average price of the bar throughout the day ("avgprice" x "number of shares traded" per bar) and dividing the total shares traded for the day.

There is not a great deal of meaning for VWAP that spans multiple days and it is not a great trend predictor as you can see in the attached picture; I am not sure if many traders follow it other than that there is a correlation between daily VWAP and Market Profile's idea of POC (Point of control). The previous ELD attached in this thread will not do VWAP across different trading days. There is some code below from the TS forum that will, posted below.

{ plot a five-day VWAP to use on my charts } 

{ Format -> Symbol... -> Settings tab -> For volume, use: Trade Vol } 

{ Need more than 5 days of data not including bars to satisfy MaxBarsBack } 

inputs: 
Price( AvgPrice ), 
Color( Red ); 

variables: 
Trade_Vol( 0 ), 
VWAP_5Day( 0 ), 
TLID( -1 ), 
x( 0 ); 

arrays:	 
VPSum[5]( 0 ), 
VSum[5]( 0 ); 

if Date <> Date[1] then { detect day changes } 
begin 
{ Build the arrays of Summed Price and Volume } 
for x = 5 downto 1 
	begin 
	VPSum[x] = VPSum[x-1] ; 
	VSum[x] = VSum[x-1] ; 
	end ; 
if VSum[5] > 0 then 
	begin 
	{ Calculate the 5-day VWAP once values for the 5th day are obtained } 
	VWAP_5Day = SummationArray( VPSum, 5 ) / SummationArray( VSum, 5 ) ; 
	{ Plot the end of each day starting with the 5th day } 
	Plot1( VWAP_5Day, "VWAP_5Day", Color ) ; 
	{ Project last calculated VWAP_5Day forward with a Trendline } 
	if TLID = -1 then 
		begin 
		TLID = TL_New( Date[1], Time[1], VWAP_5Day, Date, Time, VWAP_5Day ) ; 
		TL_SetExtRight( TLID, true ) ; 
		TL_SetColor( TLID, Color ) ; 
		end 
	else 
		begin 
		TL_SetEnd( TLID, Date, Time, VWAP_5Day ) ; 
		TL_SetBegin( TLID, Date[1], Time[1], VWAP_5Day ) ; 
		end ; 
	end ; 
end ; 

if BarType >= 2 then { ie, not tick/minute data } 
Trade_Vol = Volume 
else { if tick/minute data } 
Trade_Vol = Ticks ; 

{ Sum Price and Volume data } 
VPSum[0] = VPSum[0] + Trade_Vol * Price ; 
VSum[0] = VSum[0] + Trade_Vol ; 

5aa70e303ddac_Calculatethe5-dayVWAPoncevaluesforthe5thdayareobtained2008-01-05_111820.png.228fe5bf65f7373b8bb7d2e65c565ce9.png

Share this post


Link to post
Share on other sites

I thought it would make a difference depending on the start point...so the BIG question is, what is the best start point? 12am? 8am?

 

Since I am a newbie trader, any one want to suggest what they are using?

 

Thanks TRunner for the other version of vwap...i'll take a look at it over multiple days...from your post, it doesn't look like it means much...at least for the past few weeks.

Share this post


Link to post
Share on other sites

I don't know, there is something very wrong with both Ensign and the TS vwap/bands in those charts.

I wonder if Jerry could post a chart from that day? I've noticed with alot of the versions people have wrote up, something is totally off with the variance calculations for the bands. With that big drop at the open the dev band away from price should be expanding. Alot of the versions people have made the bands just look like channels while in Jerry's videos they look more like "claws".

Investors r/t seems to be the closest to what Jerry did in his videos. Here is a chart from marketdelta/investors RT with DTN iq feed. The variance setting for investors r/t seems to get like what Jerry does, then the proprietary is different as price never seems to get beyond the 2nd standard dev band on any chart i've pulled up.

vwapbands.jpg.582b4fc43139554d2d21962b812fab4e.jpg

Share this post


Link to post
Share on other sites
I don't know, there is something very wrong with both Ensign and the TS vwap/bands in those charts.
Please see the attached PNG. The TS VWAP SD appears to match what you displayed if TS code is set to 0930 regular trading hours (EST). By default, both the Ensign and TS appeared to use the start of next day as basis for calculation.

5aa70e3176f41_TSVWAPSD2008-01-04_180248.png.51eb7bf195db8bdb9dbfdfa3d94dd4cb.png

Share this post


Link to post
Share on other sites
I don't know, there is something very wrong with both Ensign and the TS vwap/bands in those charts.

I wonder if Jerry could post a chart from that day? I've noticed with alot of the versions people have wrote up, something is totally off with the variance calculations for the bands. With that big drop at the open the dev band away from price should be expanding. Alot of the versions people have made the bands just look like channels while in Jerry's videos they look more like "claws".

Investors r/t seems to be the closest to what Jerry did in his videos. Here is a chart from marketdelta/investors RT with DTN iq feed. The variance setting for investors r/t seems to get like what Jerry does, then the proprietary is different as price never seems to get beyond the 2nd standard dev band on any chart i've pulled up.

 

Hi Darth, firstly I am no maths expert though I did do a degree in a math heavy subject ... that was in the stoneage! I did do a bit of research (actually a lot) when Jerry first published this excellent series.

 

There are a few algorithms out there for variance but they can be prone to accuracy errors due to overflow and underflow. More likely an issue is when using anything but individual ticks you need to decide what price level to assign the volume of that bar to. Ensign I think uses a uniform distribution at each level from bar high to low. I guess some might use mid points or other methods. Sounds like this might not be the issue you have got. By definition price will get to the 3rd standar deviation X% of the time (can't remember what X is but its pretty small) from memory 2SD's is something like 2% of the sample. anyway no real answers but some food for thought.

 

Cheers.

Share this post


Link to post
Share on other sites

Thank you for your comments Blowfish. As a long time user of Multicharts, could you please comment on the following chart where the VWAP-SD indicator plots dramatically moved up and down vs the underlying bars as one scrolls along the x axis. Is this a bug in MC? Is there an easy fix? The same code in TS and MC also do not show the same results. Thanks.

5aa70e31ed514_MCcomboTSVWAPSD2008-01-08_202607.thumb.png.120f0660aebd7315e250bd77bbe3fabd.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • Date: 22nd November 2024.   BTC flirts with $100K, Stocks higher, Eurozone PMI signals recession risk.   Asia & European Sessions:   Geopolitical risks are back in the spotlight on fears of escalation in the Ukraine-Russia after Russia reportedly used a new ICBM to retaliate against Ukraine’s use of US and UK made missiles to attack inside Russia. The markets continue to assess the election results as President-elect Trump fills in his cabinet choices, with the key Treasury Secretary spot still open. The Fed’s rate path continues to be debated with a -25 bp December cut seen as 50-50. Earnings season is coming to an end after mixed reports, though AI remains a major driver. Profit taking and rebalancing into year-end are adding to gyrations too. Wall Street rallied, led by the Dow’s 1.06% broadbased pop. The S&P500 advanced 0.53% and the NASDAQ inched up 0.03%. Asian stocks rose after  Nvidia’s rally. Nikkei added 1% to 38,415.32 after the Tokyo inflation data slowed to 2.3% in October from 2.5% in the prior month, reaching its lowest level since January. The rally was also supported by chip-related stocks tracked Nvidia. Overnight-indexed swaps indicate that it’s certain the Reserve Bank of New Zealand will cut its policy rate by 50 basis points on Nov. 27, with a 22% chance of a 75 basis points reduction. European stocks futures climbed even though German Q3 GDP growth revised down to 0.1% q/q from the 0.2% q/q reported initially. Cryptocurrency market has gained approximately $1 trillion since Trump’s victory in the Nov. 5 election. Recent announcement for the SEC boosted cryptos. Chair Gary Gensler will step down on January 20, the day Trump is set to be inaugurated. Gensler has pushed for more protections for crypto investors. MicroStrategy Inc.’s plans to accelerate purchases of the token, and the debut of options on US Bitcoin ETFs also support this rally. Trump’s transition team has begun discussions on the possibility of creating a new White House position focused on digital asset policy.     Financial Markets Performance: The US Dollar recovered overnight and closed at 107.00. Bitcoin currently at 99,300,  flirting with a run toward the 100,000 level. The EURUSD drifts below 1.05, the GBPUSD dips to June’s bottom at 1.2570, while USDJPY rebounded to 154.94. The AUDNZD spiked to 2-year highs amid speculation the RBNZ will cut the official cash rate by more than 50 bps next week. Oil surged 2.12% to $70.46. Gold spiked to 2,697 after escalation alerts between Russia and Ukraine. Heightened geopolitical tensions drove investors toward safe-haven assets. Gold has surged by 30% this year. Haven demand balanced out the pressure from a strong USD following mixed US labor data. Silver rose 0.9% to 31.38, while palladium increased by 0.9% to 1,040.85 per ounce. Platinum remained unchanged. Always trade with strict risk management. Your capital is the single most important aspect of your trading business.   Please note that times displayed based on local time zone and are from time of writing this report.   Click HERE to access the full HFM Economic calendar.   Want to learn to trade and analyse the markets? Join our webinars and get analysis and trading ideas combined with better understanding of how markets work. Click HERE to register for FREE!   Click HERE to READ more Market news. Andria Pichidi HFMarkets Disclaimer: This material is provided as a general marketing communication for information purposes only and does not constitute an independent investment research. Nothing in this communication contains, or should be considered as containing, an investment advice or an investment recommendation or a solicitation for the purpose of buying or selling of any financial instrument. All information provided is gathered from reputable sources and any information containing an indication of past performance is not a guarantee or reliable indicator of future performance. Users acknowledge that any investment in FX and CFDs products is characterized by a certain degree of uncertainty and that any investment of this nature involves a high level of risk for which the users are solely responsible and liable. We assume no liability for any loss arising from any investment made based on the information provided in this communication. This communication must not be reproduced or further distributed without our prior written permission.
    • A few trending stocks at support BAM MNKD RBBN at https://stockconsultant.com/?MNKD
    • BMBL Bumble stock watch, pull back to 7.94 support area with high trade quality at https://stockconsultant.com/?BMBL
    • LUMN Lumen Technologies stock watch, pull back to 7.43 support area with bullish indicators at https://stockconsultant.com/?LUMN
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.