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: 29th March 2024. GBPUSD Analysis: The Pound Trades Higher But For How Long? The global Stocks Markets are closed due to Easter Friday (Good Friday). The NASDAQ continued to follow the sideways trend while other indices again rose. The SNP500 reaches an all-time high, but the NASDAQ remains under pressure from Tesla, Meta and Apple. The Euro continues to trade lower against all major currencies including the US Dollar, Euro and Japanese Yen. The British Pound is the best performing currency during this morning’s Asian session. However, investors are largely fixing their attention on this afternoon’s Core PCE Price Index. GBPUSD – The Pound Trades Higher but For How Long? The GBPUSD is slightly higher than the day’s open and is primary due to the Pound’s strong performance. At the moment, the British Pound is increasing in value against all major currencies. However, the US Dollar Index is also trading 0.10% higher and for this reason there is a slight conflict here. If investors wish to avoid this conflict, the EURUSD is a better option. This is because, the Euro depreciating against the whole currency market avoiding the “tug-of-war” scenario. The GBPUSD is trading slightly lower than the 2-month’s average price and is trading at 49.10 on the RSI. For this reason, the price of the exchange is at a “neutral” level and is signalling neither a buy nor a sell. The day’s price action and future signals are possibly likely to be triggered by this afternoon’s Core PCE Price Index. Analysts expect the Core PCE Price Index to read 0.3% which is slightly lower than the previous month but will result in the annual figure remaining at 2.85%. The PCE rate is different to the inflation rate and the Fed aims for a rate between 1.5% to 2.00%. Therefore, even if the annual rate remains at 2.85%, as analysts expect, it would be too high for the Fed. If the rate increases, even if only slightly, the US Dollar can again renew bullish momentum and the stock market can come under pressure. This includes the SNP500. Investors are focused on the publication of data on the UK’s gross domestic product (GDP) for the last quarter of 2023: the quarterly figures decreased by 0.3%, and 0.2% over the past 12-months. This confirms the state of a shallow recession and the need for stimulation. The data, combined with a cooling labor market and a steady decline in inflation, increase the likelihood that the Bank of England will soon begin interest rate cuts. In the latest meeting the Bank of England representatives did not see any members vote for a hike. USA500 – The SNP500 Rises to New Highs, But Cannot Hold Onto Gains! The price of the SNP500 rises to an all-time high, before correcting 0.33% and ending the day slightly lower than the open price. Nonetheless, the index performs better than the NASDAQ which came under pressure from Tesla, Meta and Apple which hold a higher weight compared to the SNP500. For the SNP500, these 3 stocks hold a weight of 9.25%, whereas the 3 stocks make up 14.63% of the NASDAQ. The SNP500 is also supported by ExxonMobil’s gains due to higher energy prices. The market will remain closed on Friday due to Easter. However, the market will reopen on Monday for the US and investors can expect high volatility. Investors will also need to take into consideration how the PCE Price Index and the changed value of the US Dollar is likely to affect the stock market next week. 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 on how markets work. Click HERE to register for FREE! Click HERE to READ more Market news. Michalis Efthymiou Market Analyst 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.
    • MT4 is good and will be good until their parent company keep updating the software, later mt4 users will have to switch to mt5.
    • $SOUN SoundHound AI stock at 5.91 support area , see https://stockconsultant.com/?SOUN
    • $ELEV Elevation Oncology stock bull flag breakout watch , see https://stockconsultant.com/?ELEV
    • $AVDX AvidXchange stock narrow range breakout watch above 13.32 , see https://stockconsultant.com/?AVDX
×
×
  • Create New...

Important Information

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