Trading Indicators Share, download, and discuss trading indicators. 
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  56  05:31 PM 04152013 
The Following 16 Users Say Thank You to dbntina For This Useful Post:  
ClocharT (01022011), cunparis (03292010), hawk_7_7 (12052008), hiteshshah1 (08102017), mb3000 (06212009), opmtraders (12262008), ppcl (02152016), proton242 (02282011), RomanFx (07282009), ronnn777 (02212009), Tams (05042009), TIKITRADER (08062009), tradingbigboy (04192016), vero (08222010), wuxw (09082011) 
Comments 
08032007, 12:56 PM  #2  
Re: VWAP Indicator with 1SD and 2SD bands
dbntina: Thank you for posting this. I had always wanted an indicator that provided statistical representation of what was happening today. Nice job!  

08032007, 01:40 PM  #3  
Re: VWAP Indicator with 1SD and 2SD bands
Good post mate. I've been wanting to do this since reading Jpearls threads. I am however using ninja trader, so (if you dont mind) Im going to try and convert your code to ninja script. I dont think there are too many ninja users out there  everybody seems to use esignal or tradestation! Cheers, Jay.  

08032007, 01:51 PM  #4  
Re: VWAP Indicator with 1SD and 2SD bands
Hi DbnTina, I am not sure if the calculation for vi is correct. In your EL you have used variance_i = ((UpTicks[Value1]+DownTicks[Value1])/ShareW) * (Square(AvgPrice[i]VolWAPValue)); where (UpTicks[i]+DownTicks[i]) represents volume of the bar [i]... I think in a probability calculation one should use total volume at price i, not just volume of the bar i. Lets ask Jerry for clarification.  

08032007, 07:22 PM  #5  
Re: VWAP Indicator with 1SD and 2SD bands I am not sure if the calculation for vi is correct. In your EL you have used variance_i = ((UpTicks[Value1]+DownTicks[Value1])/ShareW) * (Square(AvgPrice[i]VolWAPValue)); where (UpTicks[i]+DownTicks[i]) represents volume of the bar [i]... I think in a probability calculation one should use total volume at price i, not just volume of the bar i. Lets ask Jerry for clarification. NickM001, You are correct. In the code, ShareW is always the total share volume up to the current time from your start. You divide the volume of the current bar by the total volume and use this "normalized volume" to multiply with according to Jerry. This should be correct if I am understanding the formula correctly. It also seems to line up with Jerry's bands so I think it is correct. Let me know...I can correct if I am not suppossed to normalize this way... Thanks for taking a look at the code if it is incorrect we want to find out now. dbntina  

08032007, 08:30 PM  #6  
Re: VWAP Indicator with 1SD and 2SD bands
Hi dbntina, Thank you for your contribution. If you happen to need any updating on the code, threads here can be edited at anytime so please feel free to do so. Also, would it be possible to add a screenshot of the indicator in action? It would help traders give a visual clue on what the indicator is all about. Thanks.  

08032007, 10:51 PM  #7  
Re: VWAP Indicator with 1SD and 2SD bands
Soultrader...will try to do a screenshot on Monday...everythings at work...good idea. Thanks, dbntina  

08042007, 12:46 AM  #8  
Re: VWAP Indicator with 1SD and 2SD bands
OK let me try to explain again my understanding of the formula. Let quote what Jerry wrote in his explanation: QUOTE#################### ################### While we won't address all these questions in one thread their answers can be obtained by analysis of the volume distribution function. To do so requires that we introduce a third property of the volume distribution function called the Standard Deviation of the VWAP, SD for short. SD is computed from the following equations: NOTE : Formula did not copy ... see http://www.traderslaboratory.com/for...dard2101.html where the summation subscript i, runs over all prices in the volume distribution pi = ith price in the volume distribution Pi = vi/V is the probability of occurrence of price pi vi = the volume traded at price pi from the volume distribution V = total volume for the entire distribution ######################### ######## Note that factor vi is volume traded at price pi. If I understand your code, you have used volume of the bar[i], or volume at time [i], not as described in the formula. To get proper value for vi, you would have to keep track of all the volume distribution at EACH price level of the range in the array and use the value of volume array element [i] that corresponds to price pi. It can be done, but it would take more then few lines of code, unfortunately. For some odd reason, it does not seem to make much difference even if you set vi/V = 1, for the few sample charts I looked at. So for all practical purposes, SD value is usable...  

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  66  11112014 12:30 PM 
Trading with Market Statistics III. Basics of VWAP Trading  jperl  Market Profile  77  08202014 11:06 AM 
Question regarding Bollinger Bands  Robert  Technical Analysis  22  08082009 11:37 PM 
Is the RSI indicator any good?  Lisa  Technical Analysis  14  04272008 01:41 PM 