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

    • INO Inovio Pharmaceuticals stock low volume pullback to 9.77 support area, watch for local breakout above 10.5, https://stockconsultant.com/?INO
    • GOOG Alphabet stock good trend, top of range breakout watch above 180.55, https://stockconsultant.com/?GOOG
    • Date: 7th June 2024. ECB closer look: All options open for the second half of the year! ECB officials continue to dampen rate cut speculation, following on from Lagarde’s hawkish comments yesterday. Officials have been out in force this morning to continue stressing that the inflation outlook remains uncertain and that the central bank is not committing to a particular rate path for the rest of the year. The ECB cut rates by 25 basis points, but as we expected it was a “hawkish” cut that left all options open for the second half of the year. Lagarde repeatedly stressed that future decisions will be data dependent, and even refused to confirm that yesterday’s move was the first step of an easing cycle. Rate cuts in September and December are still a possibility, but not cast in stone. Simkus admitted that there may be more than one rate cut this year, but on the whole, the comments were designed to keep a lid on speculation that the central bank kicked off a rate cut cycle yesterday. Austria’s central bank head Holzmann went on record yesterday to confirm that he was the sole dissenter objecting to a cut yesterday, and so far the doves have been quiet, which is helping to affirm Lagarde’s hawkish message yesterday.   Details of the Rate Cut The ECB delivered the first rate cut in five years and lowered key rates by 25 basis points. The deposit rate is now at 3.75% and the main refinancing rate at 4.25%. It was a “hawkish cut,” as near term inflation forecasts were revised higher, and Lagarde flagged that domestic inflation remains high. The statement stressed that the ECB is not pre-committing to a particular rate path, and the comments leave all options on the table for the second half of the year.   Economic Activity and Forecasts  The ECB noted the improvement in economic activity through the first quarter of the year. Lagarde also highlighted that manufacturing is showing signs of stabilization, with stronger exports expected to support growth in coming quarters. At the same time, monetary policy should be less of a drag on demand over time, according to the ECB. The new set of forecasts show GDP rising 0.9% this year, which is more than the 0.6% expected back in March. The forecast for 2025 has been revised slightly down to 1.4% from 1.5% previously, and the ECB still expects a slight acceleration to 1.6% for 2026. The inflation forecast for this year was raised to 2.5% from 2.3%, and the projection for 2025 was hiked to 2.2% from 2.0%. As such, inflation will fall toward the target later than previously anticipated, though the forecast for 2026 was left unchanged at 1.9%. This means the headline rate is still expected to fall below the target at the end of the forecast horizon.   Upside Risks to Inflation The statement noted upside risks to the inflation outlook from wages and profits, which could be higher than currently anticipated. Geopolitical tensions and extreme weather events could also push up prices once again, according to the ECB. At the same time, the ECB acknowledged that inflation could come in lower than anticipated if monetary restrictions have more of a dampening effect than currently anticipated, or if global growth weakens more than projected.   The press conference was mainly dedicated to driving home the point that future decisions will depend on data available at the time of the respective meeting. Lagarde even refused to confirm that the central bank has effectively kicked off an easing cycle, and said in response to a question that she wouldn’t necessarily say that the ECB started a “dialing-back process”. She suggested it is likely, but refused to confirm it, which in theory means rates could actually go up again. This seems unlikely, given that this move was a near unanimous decision, but its makes clear that the ECB will not cut rates at every meeting and that the outlook for the rest of the year is still very much open. The ECB still thinks that monetary policy needs to remain restrictive for the foreseeable future against the backdrop of high domestic inflation. However, as chief economist Lane suggested recently, officials will have to debate at every meeting whether the data allows the central bank to dial back the degree of restrictiveness.   Employment and Inflation Dynamics Wage growth, profits, and services price inflation will remain the key numbers to watch through the rest of the year. Lagarde pointed to data on the compensation of employees, due to be released tomorrow, but also flagged that current wage agreements are often still backward looking, as they reflect attempts to compensate for the sharp rise in prices since the start of the Ukraine war. As we flagged previously, the multi-year wage agreements in Germany are a prime example of that. However, as Lagarde highlighted, the deals on the table so far show sharp increases for this year, but also imply a slowdown in wage growth in coming years. However, unemployment is at a record low and the number of vacancies has dropped only slightly. At the same time, service price inflation remains stubbornly high, which suggests that companies have sufficient room to pass on higher labor costs. With real disposable income rising, thanks to lower inflation and higher wages, companies could find it even easier to hike prices in the second half of the year, and yesterday’s rate cut is also likely to boost demand. In the current situation, this could add to domestic price pressures. Looking ahead, the only thing that is clear is that Lagarde did her best to keep expectations of back-to-back cuts under control. The chances still are that the ECB will deliver two more 25 basis point cuts in September and December, but at this point, nothing is cast in stone. 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. Andria Pichidi 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.
    • TRGP Targa Resources stock narrow range breakout watch above 119.02, https://stockconsultant.com/?TRGP
    • ROOT stock, short term downtrend break, bullish stats , https://stockconsultant.com/?ROOT
×
×
  • Create New...

Important Information

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