| Trading Indicators Post your custom trading indicators. If you download, remember to click INSTALL. |
![]() | | Tweet | |
VWAP Indicator with 1SD and 2SD bands Details »» | |||||||||||||||||||||||||||
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
Show Your Support
| |||||||||||||||||||||||||||
| ∧ 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: | ||
| Comments |
| | #74 | ||
![]() | Re: VWAP Indicator with 1SD and 2SD bands Quote:
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);
} | ||
| |
|
| | #75 | ||
![]() | Re: VWAP Indicator with 1SD and 2SD bands | ||
| |
|
| | #76 | ||
![]() | 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 C Program Files\eSignal\FunctionLib rary\*thats it. | ||
| |
|
| | #77 | ||
![]() | Re: VWAP Indicator with 1SD and 2SD bands 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 | ||
| |
|
| | #78 | ||
![]() | Re: VWAP Indicator with 1SD and 2SD bands Quote:
Yes 2SD is 2*1SD. | ||
| |
|
| | #79 | ||
![]() | Re: VWAP Indicator with 1SD and 2SD bands | ||
| |
|
| | #80 | ||
![]() | Re: VWAP Indicator with 1SD and 2SD bands | ||
| |
|
| | #81 | ||
![]() | Re: VWAP Indicator with 1SD and 2SD bands 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. | ||
| |
|
![]() |
| Tags |
| vwap |
| Thread Tools | |
| 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 |