Welcome to the Traders Laboratory Forums.
Trading Indicators Post your custom trading indicators. If you download, remember to click INSTALL.

Reply
VWAP Indicator with 1SD and 2SD bands Details »»
VWAP Indicator with 1SD and 2SD bands
Platform: , by dbntina dbntina is offline
Developer Last Online: May 2012 Show Printable Version Email this Page

Platform: Unknown Rating: (5 votes - 4.20 average)
Released: 08-03-2007 Last Update: Never Installs: 0
 
No support by the author.

Guys I am not a TS coding guru by any means...still new at it but wanted to share this code if anyone else was interested. Just wrote this code for myself to keep up with JPERL's threads on Market Statistics. It plots the VWAP, and 1st and 2nd Standard Deviation bands. It lines up with his numbers within a tick or two so I think it is working correctly.

Any other TS coders out there please take a look because it can probably be improved upon.

This is my first post of a file so if I screwed something up...be gentle!

Hope this helps,

dbntina
boxmeister

Download Now

File Type: eld DBVWAP_SD.ELD (5.0 KB, 1458 views)

Show Your Support

  • If you like to thanks you by the author -> Click Thanks to the Author
  • This modification may not be copied, reproduced or published elsewhere without the author's permission.

Similar Indicator
Mod Developer Type Replies Last Post
TS Tick by Tick PVP Plotted with VWAP and SD Bands dbntina Trading Indicators 51 11:54 AM 02-18-2012
The Following 13 Users Say Thank You to dbntina For This Useful Post:
ClocharT (01-02-2011), cunparis (03-29-2010), hawk_7_7 (12-04-2008), mb3000 (06-21-2009), opmtraders (12-26-2008), proton242 (02-28-2011), RomanFx (07-28-2009), ronnn777 (02-21-2009), Tams (05-04-2009), TIKITRADER (08-06-2009), vero (08-22-2010), wuxw (09-08-2011)

Comments
Old 12-18-2008, 04:52 PM   #74

Head2k's Avatar

Join Date: Jul 2008
Location: N/A
Posts: 313
Ignore this user

Thanks: 140
Thanked 290 Times in 129 Posts

Re: VWAP Indicator with 1SD and 2SD bands

Quote:
Originally Posted by shanmugam0230 »
can any one help me to plot VWAP in amibroker?
This is VWAP with SDs and (last value of) PVP for AmiBroker which I programed some time ago. It doesn't plot volume distribution, because AmiBroker can plot it on itself since version 5.20. I don't know how fast PC do you have, but the PVP calculation is quite demanding. So if you can settle for VWAP and SDs only and use AmiBroker's daily Volume at Price Overlay to judge PVP by eye, you can erase the part of code starting with ///// PVP /////. The code will be much faster then.
Also please note that I use black background, so change colors in code if needed.

Code:
ND = Day() != Ref(Day(), -1);

///// VWAP and SDs /////

P = (H + L) / 2;
VWP = P * V;
BI = BarIndex();
BeginBI = ValueWhen(ND, BI);
BeginBI = BeginBI[BarCount -1];
if(BeginBI < BarCount - 1)
	{
	InRange = BI >= BeginBI;
	CumV = Cum(V * InRange);
	CumVWP = Cum(VWP * InRange);
	VWAP = CumVWP / CumV;
	S = Cum(Ref(CumV, -1) * V * (P - Ref(VWAP, -1))^2 / CumV);
	Variance = S / CumV;
	SD = sqrt(Variance);
	VWAP = IIf(InRange, VWAP, Null);
	Plot(VWAP, "VWAP", colorYellow, styleNoTitle + styleNoRescale);
	Plot(VWAP + SD, "+1SD", colorGreen, styleDashed + styleNoTitle + styleNoRescale);
	Plot(VWAP - SD, "-1SD", colorRed, styleDashed + styleNoTitle + styleNoRescale);
	Plot(VWAP + 2*SD, "+2SD", colorSeaGreen, styleDashed + styleNoTitle + styleNoRescale);
	Plot(VWAP - 2*SD, "-2SD", colorOrange, styleDashed + styleNoTitle + styleNoRescale);
	Plot(VWAP + 3*SD, "+3SD", colorPaleGreen, styleDashed + styleNoTitle + styleNoRescale);
	Plot(VWAP - 3*SD, "-3SD", colorLightOrange, styleDashed + styleNoTitle + styleNoRescale);
	}

///// PVP /////

BarSinceND = BarsSince(ND);
iStart = Max(BarCount - 1 - BarSinceND[BarCount - 1], 0);
Top = HighestSince(ND, High);
Bot = LowestSince(ND, Low);
Range = Top - Bot;
BoxesInRange = Range / TickSize + 1;
VolUnit = Volume / ((High - Low) / TickSize + 1);
VUcount = 0;
MaxVUcount = 0;
PVP = Null;

if(iStart > 0)
{
for(i = iStart; i < BarCount; i++)
	{
	jShift = round((Bot[i - 1] - Low[i]) / TickSize);
	if((BoxesInRange[i] < BarCount))
		{
		if(jShift > 0)
			{
			LastVUcount = VUcount;
			VUcount = 0;
			for(j = jShift; j < BoxesInRange[i]; j++)
				{
				VUCount[j] = LastVUCount[j - jShift];
				}
			}
		jStart = round((Low[i] - Bot[i]) / TickSize);
		jEnd = round((High[i] - Bot[i]) / TickSize);
		for(j = jStart; j <= jEnd; j++)
			{
			VUcount[j] = VUcount[j] + VolUnit[i];
			MaxVUcount = Max(MaxVUcount, VUcount[j]);
			}
		}
	}
for(j = 0; j < BoxesInRange[BarCount - 1]; j++)
	{
	if(MaxVUcount == VUcount[j])
		PVP = Bot[BarCount - 1] + j * TickSize;
	}
Plot(PVP, "PVP", colorTurquoise, styleDots + styleNoTitle + styleNoRescale);
}
Head2k is offline  
Reply With Quote
Old 01-26-2009, 06:36 PM   #75

Join Date: Jun 2008
Location: chicago
Posts: 6
Ignore this user

Thanks: 2
Thanked 0 Times in 0 Posts

Re: VWAP Indicator with 1SD and 2SD bands

anyone has Vwap for esignal
ockrazor is offline  
Reply With Quote
Old 02-24-2009, 04:47 PM   #76

Join Date: Mar 2007
Location: toronto
Posts: 14
Ignore this user

Thanks: 0
Thanked 0 Times in 0 Posts

Post Re: VWAP Indicator with 1SD and 2SD bands

VWAP for esignal...You can get it here:

http://share.esignal.com/groupconten...FS2&groupid=10

look for AMVWAP2...(here it is attached)..you also need the amstudies function library found here:
http://share.esignal.com/groupconten...ies&groupid=10

remember to copy the AMSTUDIES.efslib to
CProgram Files\eSignal\FunctionLib rary\*

thats it.
Attached Files
File Type: zip amvwap.zip (54.8 KB, 74 views)
lj2500 is offline  
Reply With Quote
Old 03-25-2009, 11:35 AM   #77

Join Date: Jan 2009
Location: Singapore
Posts: 24
Ignore this user

Thanks: 2
Thanked 0 Times in 0 Posts

Re: VWAP Indicator with 1SD and 2SD bands

Managed to do something abt the bands in cqg, however may i ask if the bands recalculation period i set to 28 periods for 2 min periods, would it be more accurate?

i noted that if i set it to recalculate per 2 min, my chart becomes very jerky and messy, and setting it to a longer period per recalculation makes it smoother.


Is it wrong?

BTW, i got a very impt question, 2 STD DEV is 2 X 1STD DEV right? just wanan clarify.
cos this means if i managed to calcualte 1 std dev, 2 or 3 std dev shld nt be a prob
Garylim is offline  
Reply With Quote
Old 03-25-2009, 11:44 AM   #78

BlowFish's Avatar

Join Date: Mar 2007
Location: In Da House
Posts: 3,292
Ignore this user

Thanks: 129
Thanked 1,054 Times in 702 Posts

Re: VWAP Indicator with 1SD and 2SD bands

Quote:
Originally Posted by Garylim »
Managed to do something abt the bands in cqg, however may i ask if the bands recalculation period i set to 28 periods for 2 min periods, would it be more accurate?

i noted that if i set it to recalculate per 2 min, my chart becomes very jerky and messy, and setting it to a longer period per recalculation makes it smoother.


Is it wrong?

BTW, i got a very impt question, 2 STD DEV is 2 X 1STD DEV right? just wanan clarify.
cos this means if i managed to calcualte 1 std dev, 2 or 3 std dev shld nt be a prob
Load less bars (so maybe only a day or two). If you can set to only calculate on bar close (I guess thats what re-calculate every 2 minutes will do in CQG) that should improve things. Calculating every 2 minutes dosent present a problem in most charting packages, it should not in CQG either. 28 period recalculation ios going to be quite a bit less acurate.

Yes 2SD is 2*1SD.
BlowFish is offline  
Reply With Quote
Old 03-25-2009, 12:01 PM   #79

Join Date: Jan 2009
Location: Singapore
Posts: 24
Ignore this user

Thanks: 2
Thanked 0 Times in 0 Posts

Re: VWAP Indicator with 1SD and 2SD bands

hmmmmm a bit of dilemma, i use 1 period for 2 min charting is possible, but the charting turns out terribily jerky ...... but it seems to smooth out when i use longer periods of calcualtion for SD bands.....
Garylim is offline  
Reply With Quote
Old 03-25-2009, 12:12 PM   #80

Join Date: Jan 2009
Location: Singapore
Posts: 24
Ignore this user

Thanks: 2
Thanked 0 Times in 0 Posts

Re: VWAP Indicator with 1SD and 2SD bands

Does jerky bars correspond to ur charts?
Garylim is offline  
Reply With Quote
Old 03-26-2009, 07:05 AM   #81

BlowFish's Avatar

Join Date: Mar 2007
Location: In Da House
Posts: 3,292
Ignore this user

Thanks: 129
Thanked 1,054 Times in 702 Posts

Re: VWAP Indicator with 1SD and 2SD bands

I dont use CQG but SD bands on weighted data are notoriously processor intensive. Having said that running the calculations every 2 minutes is a snip for most programs (Ensign, Ninja, tradestation etc.). I wrote my own tradestation indicators that use a non iterative algorithm so no problems with jerkiness even tick by tick on a months worth of data.

How many days data are you loading ? If you are only re-calculating every 2 minutes you should have no problems....I would contact CQG as I mentioned before.
BlowFish is offline  
Reply With Quote

Reply

Tags
vwap

Thread Tools
Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trading With Market Statistics.II The Volume Weighted Average Price (VWAP). jperl Market Profile 65 02-25-2012 04:02 PM
Trading with Market Statistics III. Basics of VWAP Trading jperl Market Profile 73 01-03-2012 08:06 AM
Question regarding Bollinger Bands Robert Technical Analysis 22 08-08-2009 10:37 PM
Is the RSI indicator any good? Lisa Technical Analysis 14 04-27-2008 12:41 PM

All times are GMT -4. The time now is 05:27 AM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.