View Full Version : Vwap
NinjaTrader_Josh
07-26-2007, 04:55 PM
Please update to Release Candidate 1 (3/14/2008)
VWAP and its standard deviations. You can choose at what time to start VWAP calculations and when to end them.
Note: You can only use this indicator on intraday charts.
http://i29.tinypic.com/11l7l88.jpg
Changelog:
1.0rc1:
- Optimized VWAP and SD calculation functions
- Removed forced CalculateOnBarClose setting for newer SD calculations
1.0b10:
- Added ability for user defined multiplier on SD bands
- Added ability to disable accuracy warning
- Fixed bug in Standard Deviation Population calculations
- Fixed bug with VWAP input series selection
- Fixed bug when using in a NinjaScript Strategy
- Fixed bug with real-time VWAP calculations on tick/volume/range charts
1.0b9:
- Added Start and End Times
- Replaced SD multiplier with native support for up to 3 SD bands
1.0b8:
- Added support for more accurate SD calculations
- Fixed several plotting bugs
- Optimized code
1.0b7:
- Added compatibility with NinjaTrader 6.5
1.0b6:
- Fixed bug loading VWAP when there is no data connection
1.0b5:
- Added checks to ensure proper VWAP usage
1.0b4:
- Replaced Standard Deviation plot with a DataSeries
1.0b3:
- Added coloring between VWAP bands
1.0b2:
- Added VWAP bands
- Added on/off switches for plots
1.0b1: Added VWAP standard deviation plot
Gumphrie
07-29-2007, 08:48 AM
I like the potential in this, so I've created an indicator to trigger trades.
If you have 2 consecutive candles that close outside the VWAP bands AND the the volume is rising then you get a different colour dot.
I think its probably best to only take the first trade in the day and to have good money management, but I'm still playing with it, so anyone please let me know of any related strategy.
http://www.acuclick.net/VWAP_Trig.jpg
To import:
- Download the file contained in this thread to your desktop
- From the Control Center window select the menu File > Utilities > Import NinjaScript
- Select the downloaded file
Gumphrie
07-29-2007, 08:55 AM
And thanks uacvax!
NinjaTrader_Josh
07-29-2007, 12:23 PM
An interesting strategy idea Gumphrie. I've never played around with VWAPs that much, but maybe I will a little bit more now.
Your dot plotting method looks sweet. Mind if I copy it for my TRO_PMSM_HL and TRO_PMSM_Trend indicators?
Gumphrie
07-29-2007, 01:59 PM
Your dot plotting method looks sweet. Mind if I copy it for my TRO_PMSM_HL and TRO_PMSM_Trend indicators?
Had the same thought myself, they would look great in the slot machines, so go ahead. Very 'coin like'.
I use those dots in a lot of my indicators. I'd spent ages trying to get a decent dot out of the Plot class because as you know the Plot class has no DrawDot method, the Ninja Draw Object dots get wiped when the user removes draw objects and the dots in other indicators aren't up to much. Also note the auto-borderColor/shadowColor bit which I've also put in ModHeikenAshi, it automatically works out the inverse colour to what the user has chosen for the chart background so people don't have to mess around with their colour settings when they import the indicator if they don't have white as the background.
NinjaTrader_Josh
08-14-2007, 02:29 PM
I have been getting some inquiries as to why the VWAP std devs were converging after loading the indicator. This happens because of the way the averaging mathematics work. Ideally you want to load VWAP before market start and let it run undisturbed throughout the day to get accurate VWAP values. When you load VWAP in the middle of the day what it does is it takes the previous bars and estimates a VWAP from them. The problem arises when the indicator reaches the current bar and starts updating by the tick though. The counter incremented 1 for every historical bar, but now it is incrementing 1 for every incoming tick. This means the weight on the current bar could be a couple thousand while all historical bars could only have a combined weight of 100-200. That is what causes the convergence of the Std Dev bands. (Hope that makes sense. It is because of this issue that VWAP is general not run on historical data, but I felt that an estimated VWAP could still be useful so I allowed historical calculations.)
To "fix" this problem you can:
a) only run VWAP before market open and don't reload/modify its settings during the day
b) turn CalculateOnBarClose to true, but you will only get estimated VWAP values
Once multi-time framed indicators is available this will no longer be an issue since running calculations on a 1tick chart will produce accurate VWAP values, but till then I have uploaded a new version on the first post that will automatically adjust your indicator settings to address this issue.
marketguy2
12-20-2007, 03:24 PM
Josh,
I love your VWAP indicator. Much thanks. I am using the newest version of 6.5 and VWAP (using 3 VWAPS with 1, 2 and 3 SD's) on one chart.
It really seems to bog down NT. NT crashes every day since I added VWAP. Is there anything you can do to assist with this?
Thanks so much,
Bryan
NinjaTrader_Josh
12-20-2007, 03:30 PM
Hi Bryan,
The VWAP indicator is very intense with the calculations. When you load VWAP 3 times that triples the calculation load and most of it is redundant. I will put out a custom version that will just load 3 separate SDs. Hopefully that will be enough optimization to prevent crashing. Give me a few days though. Cheers.
Rollins
12-20-2007, 05:53 PM
Hi there,
I've created my own version of the VWAP, it's still based on Josh's code but has a few improvements. Changed the calculation a bit too which should save resources. It doesn't color the region between deviations though and uses approximation by default, calculate on bar close false will use live tick from the moment the indicator is loaded.
Cheers
sbgtrading
12-29-2007, 09:41 PM
Great indicator everyone...thank you!
ryker
02-05-2008, 12:59 PM
Hi there,
I've created my own version of the VWAP, it's still based on Josh's code but has a few improvements. Changed the calculation a bit too which should save resources. It doesn't color the region between deviations though and uses approximation by default, calculate on bar close false will use live tick from the moment the indicator is loaded.
Cheers
Hi Rollins,
For some reasons I can't get your indicator to work (I can only see the vwap band....).
Is it meant to be started before the opening if we want to see the bands or even a late start would show the bands?
Thanks, it looks like a great indicator!
Rollins
02-05-2008, 04:50 PM
Hi ryker,
There's a parameter for turning off standard deviations, I think it's set too false by default. Maybe that's the reason why it doesn't show up on your charts. The start time doesn't affect if the bands are shown or not, just their value.
ryker
02-05-2008, 07:07 PM
Ok I think I've missed it... Will try it tomorrow when I'll start NT.
Thanks
ryker
02-06-2008, 09:59 AM
It's working now.
Thanks
ryker
03-04-2008, 12:55 PM
I've discovered a small issue in the code, standard deviation must be recalculated using the new vwap and not the average vwap over the past bars as it doesn't make any sense to do it these way, so in the code vwapAvg has to be replaced by vwap (which is the latest value of the vwap).
Rollins
03-04-2008, 08:32 PM
I don't think so ryker, the defintion (http://en.wikipedia.org/wiki/Standard_deviation) states that the mean average should be used.
ryker
03-05-2008, 11:45 AM
Actually, the whole formula is incorrect as it doesn't make any sense the way you do it.
The vwap is already an average, it's the latest value of the average but it's also volume weighted. In your formula, you take the average of the vwap which is already an average (volume weighted average different than mean which is an arithmetic average).
The average you should give to your sd should be a mean, so:
sum(prices)/nbprices (or nb-1).
The formula should be:
Sumoni( (vwap-pricesi) * (vwap-pricesi) * volumesi / sumvol) )
I'll code an example based on mins bars and will post it shortly.
ryker
03-05-2008, 04:12 PM
I've coded my version using volume weighted standard deviation based on mins bars. If anybody fancy the conversion to ticks calculation? But the approximation should be close enough.
Rollins
03-05-2008, 06:06 PM
ryker, maybe you're correct but I am just not convinced. Imo if you want to calculate the standard deviation of several data points it doesn't matter how they have been calculated.
But if your version improves your trading results, that's all that matters.
rokafella
03-05-2008, 07:26 PM
Yo Ryker,
Txs.
Could I trouble you to include 3rd Std Dev. lines?
Rok
thrunner
03-05-2008, 08:43 PM
I've coded my version using volume weighted standard deviation based on mins bars. If anybody fancy the conversion to ticks calculation? But the approximation should be close enough.Thank you ryker. I appreciate your work and Rollins' work here and on TL as well, thanks everybody. I think this newVWAP is closer to the 'typical' calculation from other platforms so in that sense probably more traders are looking at this profile. There is probably no great need for a conversion to ticks as VWAP works fine even on a 15 min chart.
samiam30
03-06-2008, 01:46 AM
Thanks ryker, this is a more accurate way to calculate SD lines than the method used in other versions of the VWAP indicator.
Could you perhaps modify the indicator that Rollins posted in this thread (post#9) with the new method to calculate SD lines (it enabales using weekly, monthly...etc. vwaps).
samiam30
03-06-2008, 08:21 AM
Yo Ryker,
Txs.
Could I trouble you to include 3rd Std Dev. lines?
Rok
3rd SD added.
rokafella
03-06-2008, 08:45 AM
Txs!
:D
Rok
ryker
03-06-2008, 12:09 PM
Thanks ryker, this is a more accurate way to calculate SD lines than the method used in other versions of the VWAP indicator.
Could you perhaps modify the indicator that Rollins posted in this thread (post#9) with the new method to calculate SD lines (it enabales using weekly, monthly...etc. vwaps).
Hi,
Thanks for the addition on the 3SD.
I'm not sure to understand you there tough, Rollins's code is disabling the use of weekly monthly.. etc vwap, isn't it? Can try to add it on my code but don't know how useful it would be?
Thanks
samiam30
03-06-2008, 01:05 PM
This is how I have it set up to display the weekly VWAP:
ATI user
03-08-2008, 01:44 PM
my confusion re versions of VWAP continues...
the pic shows:
- top - VWAPmod which is Josh's VWAP with std3 and a couple of color changes only
- middle - NVWAP
- bottom - VWAPMulti
my interest is shorting/buying the VWAP extremes ...ie. short/buy above/below VWAP std3
- VWAPmod works best for this and the values are accessible from my strategy;
- with NVWAP the mkt never gets above std 3...so no trades...
- with VWAPMulti, I miss the long late in the day.....
- also the values are not accessible...from VWAPMulti at least...have not tried from NVWAP
- I have read in the forum that most traders follow the NVWAP calcs of stds...good to know for mkt reaction....are the calcs correct however?...i.e. should the mkt never exceed std3?...seems to me 1% of the prices should at least...and those are the ones I want to short/buy
- check the mkt late in the day that is near the prior low of the day...why is it so far from std3....the low and hi of the day should be at std3(99%) shouldn't they?....in which case, aren't Josh's calcs more accurate?...how can a near low of the day be above std2 on the other 2 charts???....isn't std3 to include 99% of the day's trades and therefore not include 1% of the trades?
VWAP is all the trades/volume posted at the various price levels throughout the day. At the Close there should be .5% of the trades/volume above/below the std3. Correct?
samiam30
03-08-2008, 05:34 PM
VWAP is all the trades/volume posted at the various price levels throughout the day. At the Close there should be .5% of the trades/volume above/below the std3. Correct?
I think that should only be the case if the distribution is normal (a rare occurrence in the markets).
ATI user
03-08-2008, 06:59 PM
ok...thanks....I thought the day was pretty close to normal...and wondered why the std3 is so far off the VWAP....made me wonder how useful it is from a trading point of view after the first hour or so
I did a replay of the YM and see a considerable difference at the end of the day. NVWAP appears to be more accurate...not sure why the other would change so much late in the day. They are quite close until noon and then diverge dramatically.
ATI user
03-08-2008, 10:14 PM
samiam30
I added NVWAP to my strategy and the plots on the chart are tightly compressed together. (pic 1 - indicator chart on left, strategy chart on right)
If I refresh the chart, they plot normally however converge again when I restart replay. (pic 2 - strategy chart after refresh)
The code I am using is:
Add (NVWAP());
Using the same code in a test strategy has no problem. (pic 3).
Any idea what could cause different results in my strategy? All the caculations works fine however the plots are way off. I do not add any plots in my strategy that could conflict.
Thanks.
samiam30
03-09-2008, 05:42 AM
A series of threads on different ways to utilize the volume distiribution and VWAP as a part of a trading strategy:
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-i-volume-1962.html
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-ii-the-1990.html
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-iii-basics-2008.html
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-iv-standard-2101.html
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-v-other-2130.html
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-vi-scaling-2189.html
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-vii-breakout-2232.html
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-viii-counter-2285.html
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-ix-scalping-2322.html
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-x-position-2423.html
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-xi-hup-2735.html
Can't really help you with the plotting problem.
ryker
03-09-2008, 01:27 PM
ok...thanks....I thought the day was pretty close to normal...and wondered why the std3 is so far off the VWAP....made me wonder how useful it is from a trading point of view after the first hour or so
I did a replay of the YM and see a considerable difference at the end of the day. NVWAP appears to be more accurate...not sure why the other would change so much late in the day. They are quite close until noon and then diverge dramatically.
Check the formula in the other VWAPs, for me their code is wrong and doesn't make any mathematical sense (but as Rollins said if you can use it successfully for your trading it's all that matters).
ATI user
03-09-2008, 06:00 PM
Thanks Ryker....I am using NVWAP now....still will not plot properly via a strategy so I am just using it in an indicator chart
Thanks samiam30...I had looked at those link before and gave them a more thorough look this time...I like skew and trend forecast etc. ...excellent work
Thanks everybody for such an interesting and useful thread and especially Josh for starting it. This is very timely for me since I have been using VWAP Bands in my trading for several months now, starting with the exceptional series of posts by JPerl on the Traders Laboratory Forum. I urge everyone to visit the links posted by samiam30. The discussion by Jerry and the questions by the Forum members are outstanding. Influenced by this presentation in TL, I first started out with the VWAP Bands on the Ensign Windows platform shown in the first attachment. Note that the calculation allows for fractional SD’s. On comparing this to the latest version posted by Josh (VWAP v0.1.6.beta) shown in the second attachment, you can see that the EW SD’s are almost exactly a factor of 2 off from the Ninja Trader version. Referring back to the EW chart, you can see that the +/-1.0SD lines correspond to the +/-1SD points of the Volume Histogram, giving credence to the EW calculation. The minor difference, preventing a closer agreement, is a result of the fact that I have started the Volume Histogram distribution at the opening of regular trading hours on the Russell 2000 emini (9:30 ET) and the start of the calculation of the VWAP is at the beginning of the new trading session (16:30 ET the previous day). The overnight volume in the Russell is not enough to make a big difference. Josh, if you do find that the calculation is missing this factor of 2, please change the type of the SDMultiplier to allow for non-integer SD-factors. As you can see from the charts, this allows for the inclusion of some very useful support and resistance lines from which to trade. Thanks again for your efforts.
NinjaTrader_Josh
03-10-2008, 12:20 AM
Due to bandwidth issues I am currently not updating my version, but anyone can feel free to take the base code, rip it apart, repair it, and repost.
Whoa, looks like I jumped into this discussion too quickly and didn't read all of the posts very carefully. Today I ran these indicators live for the first time. There appears to be some serious problems with the operations of the various versions of this indicator. The first attachment shows the latest version uploaded by Josh. The warning at the bottom of the chart ("VWAP is accurate if loaded before the market start. The current VWAP values displayed will only be estimates.") is accurate in that when the VWAP starts the day at zero, it accumulates the proper values throughout the day. However, if for some reason you need to reload the chart, lose the connection, or what have you, the VWAP and its SD bands become "unstable." A similar thing happens with two of the other versions (NewVWAP and NVWAP. The second attachment shows the NVWAP.). This was noted by other users here in this thread, but I didn't fully appreciate how serious this was until I tried it myself. The fourth version uploaded here (VWAPMulti) doesn't suffer from this instability problem. Its VWAP value (I couldn't plot the VWAP directly, had to plot a band with SD=0) agrees exactly with the Ensign Windows calculation, but the individual band lines differed somewhat (by as much as a half a point or more on the Russell 2000 chart). This may be attributed to the fact that I am using two different data sources, esignal for the Ensign Windows VWAP and Zenfire for the Ninja Trader version. Unfortunately, I don't have the time or the experience to take Josh up on his offer, so I think I'll revert back to my Ensign Windows VWAP charts until someone with more experience picks up the ball and runs with it. Thanks to all for your efforts here. It is appreciated.
ATI user
03-10-2008, 04:00 PM
I solved my converging plot problem in NVWAP.
I was using it in a strategy which uses CalculateOnBarClose = false;
This setting overrides the NVWAP indicator setting and the lines do not plot properly...and they converge on chart refresh.
After setting my strategy to 'true', the lines plot properly.
I also tested NVWAP in a simple indicator chart, and it will converge if you set CalculateOnBarClose = false
gpq...I suspect that is your problem as with a true setting I can not get NVWAP to fail on chart refresh in either an indicator chart or a strategy chart.
VWAP.cs on the other hand will converge on refresh (with a true or false setting) and must load prior to the open.
NinjaTrader_Josh
03-11-2008, 04:40 AM
According to the Traders Laboratory article (http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-iv-standard-2101.html) about VWAP and Standard Deviation, ryker, your calculation for SD is also flawed.
Your code in NVWAP:
for( int x = 0; x < Bars.BarsSinceSession; x++ )
{
sd += (volData[x]*(vwap-volPriceData[x])*(vwap-volPriceData[x]))/sumvol;
}
sd = System.Math.Sqrt(sd);The equation to use is the one with a probability distribution, but your probability term is flawed:
http://upload.wikimedia.org/math/d/2/f/d2f2533ae12b3b42c7d2ca67d5d0f402.png
From the TL article, the variance is this equation:
http://www.traderslaboratory.com/forums/attachment.php?attachmentid=2043
where big Pi is the probability of price i. This is found by doing (volume at price i)/(total volume).
Your implementation currently just uses volData[x] which is simply the current volume at price i and not the cumulated volume of all trades that occured at price i. Hope that makes sense. Quickly becomes an extravagant programming exercise similar to Market Profile.
ryker
03-11-2008, 07:33 AM
Thanks Josh,
Very good point, I derived my SD formula from my VWAP which actually is incorrect.
For a good approximation, I should calculate the VWAP with the volume distribution @ price and not the volume/bar... And then calculate the SD.
I will make the modification and try to repost the indicator tonight.
NinjaTrader_Josh
03-11-2008, 08:02 AM
I've released a new version addressing several of the concerns brought up in this thread on the first page. Hopefully you guys will find it suitable to your tastes now.
ATI user
03-11-2008, 08:33 AM
Looks good on ydy data Josh...then on Open, the chart went blank...no vwap and no candles
checked Indicator...shows vwap running....Log error = "Error on plotting indicator 'VWAP'. Please check the 'Plot' method. Overflow error".
Rollins
03-11-2008, 09:12 AM
Sounds like a division by zero, I had that too for zero total volume but that was the only problem during the indicator modification.
Great job Josh, producing some nice reults :D.
ATI user
03-11-2008, 09:20 AM
still can not get it to work properly...
pic 2 - note session line placement
pic 3 - time scale within session start time
...days back = 3
NinjaTrader_Josh
03-11-2008, 12:50 PM
Not sure what you mean by "Looks good on ydy data Josh...then on Open, the chart went blank...no vwap and no candles". Can you please describe exactly what you are doing? Thanks.
ATI user
03-11-2008, 01:24 PM
I loaded your version 7 prior to the open...it looked fine on pre-mkt data
at the open at 9:30, the chart went blank...and the error showed up in the Log
ATI user
03-11-2008, 01:32 PM
Josh
The problem occurs when the chart is re-sized.
I have a chart with 6 days back of data. Once I set the chart size and get the vwap plotting properly, if I re-size the chart bigger, it goes blank and I get the error msg
I should say that when the chart is re-sized so that the session start time appears in the chart, then it goes blank
Otherwise, it works great and has the exact same std2 values as NVWAP...and does not converge on refresh....and setting of CalculateOnBarClose does not seem to have an effect
garciaal
03-11-2008, 01:44 PM
I loaded it later in the day at 2:30 Pm , also getting a blank chart??
Al
NinjaTrader_Josh
03-11-2008, 02:29 PM
ATI User:
Let me get this clear. Did you invalidate your original comment about loading premarket then getting messed up once market starts and narrowed it down to chart resizing? By resizing do you mean expanding the chart window or zoom in/out on the time axis?
I can't reproduce any chart resizing issues on my end.
garciaal: Same error? Please provide me with the error and reproduce steps.
ATI user
03-11-2008, 02:57 PM
Josh
I believe the open, which is the session time start in my chart (9:30 EDT), is the same issue as resizing (by expanding the chart window so that the sesssion start is in the chart).
Meaning, whenever the session start is in the window, there are no bars.
To reproduce: open a 420 tick YM chart, set the session start time in the Chart Properties to 9:30AM, load VWAP, either widen the time scale, or narrow the chart, so that the session start time is not in the chart. Click F5 if necessary to get bars and vwap. Now drag the right side of the chart to expand the window, or compress the timescale, so that the session start time is in the chart. The bars and vwap disappear. Click F5 now and you get the error in the Log
NinjaTrader_Josh
03-11-2008, 03:36 PM
I don't know what is happening on your end because I can't reproduce on my end at all. I tried with YM, but the screenshot just happens to be AAPL. Shouldn't matter.
Also, please try version 0.1.8.
ATI user
03-11-2008, 03:45 PM
literally, the only difference in the 2 charts below is that the timescale has been compressed on the bottom chart so that the session start time is in the chart
in chart properties the session start is 9:30 and session end is 9:29
i will try version 8...thanks
NinjaTrader_Josh
03-11-2008, 03:54 PM
What version of NT are you on? Because I am at PST my session begin/end are 6:30AM and 6:29AM respectively.
garciaal
03-11-2008, 04:14 PM
Josh,
I'm using 6.5.0.10. I downloaded your ver .8 and loaded, here is the error message I get in log:
3/11/2008 17:01 Default Error on calling the 'OnBarUpdate' method for indicator 'VWAP' on bar 0: Index was out of range. Must be non-negative and less than the size of the collection.
This was after market had close so no data coming in. Is that a requirement?
At least it didn't give me a blank chart,
but no indicator either.
Also i using military time start 09:30 end 16:15, is that correct?
Thanks, Al
ATI user
03-11-2008, 04:14 PM
Josh
Way to go. Version 8 is perfect. I tried everything to make it fail...ran YM and CL through on reply at 500x...refreshed mid-day....had CalculateOnBarClose true and false...session start in/out of chart. Perfect.
I compared the values for 3 stds with NVWAP and they are within a tick or two.
Way to go! Your best VWAP by leagues!
Best of all...I can run it from my Strategy now with CalculateOnBarClose = False
Thanks a ton.
ps. I am on NT 10 beta.
ATI user
03-11-2008, 04:47 PM
Josh
A small problem.
Put VWAP in my strategy. Ran the first hour of CL on replay. First chart shows VWAP plotting way off market. Second chart shows plot after refresh/F5
For some reason, on the Open, the stds are way off. The second chart shows the correct plots with the market hugging the std2 line.
Will test for YM and post if different
Thanks.
ATI user
03-11-2008, 04:58 PM
Josh
Same problem with YM open
NinjaTrader_Josh
03-11-2008, 05:17 PM
Can you send me the replay files you are using? josh[at] ninjatrader[dot] com
garciaal
03-11-2008, 07:24 PM
Josh,
could you answer my questions at post #53
Josh, if possible, would you make the following changes in your next beta? (1) The string "VWAP is most accurate when loaded..." is covering the location of the Tick/Volume/Time Counter Indicator (you can remove it entirely, if you want). (2) Please make allowance for non-integer, user-defined SD Multiplier inputs for each SD Band. Thanks for your patience and skill in putting this useful indicator together.
ATI user
03-11-2008, 10:26 PM
Josh
It would appear the plot problem at the Open has something to do with values going to zero.
CL opens at 9:00 AM
pic 1 - values of SD2 are fine until 9:01:20 AM when they go to zero
pic 2 - the values stay at zero through 9:03:24 at which time I stop replay to refresh
pic 3 - after F5 refresh, values show non-zero for the same time they were previously zero ...i.e. 9:01:20 through 9:02:25...and then become zero again at 9:03:24
I am accessing values from VWAP to make trades and intermittently get zero...for long periods of time ...which of course does not work...i.e. suddenly the market is above SD2Upper because it just went to 0.
Exact same results with YM replay.
I am assuming the zero values might also be throwing off the plot? Why the session start causes the problem I will wait to hear from you.
Thanks
ATI user
03-11-2008, 10:55 PM
the problem is the initial setting of the SDs on the open
I thought maybe a tick chart was the problem, so ran a 1 min chart....see pic
The values of the SDs are 0 during the first minute and then have a value from the first second of the second minute and thereafter....for the 80 minutes of data I ran anyway.
The 210 tick chart makes the problem worse....and intermittent?
Maybe on the open the SDs should all be set to the Open of the first bar instead of 0?
Anyway pic 2 is pre-F5 and pic 3 is post-F5.....no difference....on 1 min
pic 4 shows value for 3 min chart....all 0s until second bar....no wonder 210 tick bar had a problem
NinjaTrader_Josh
03-12-2008, 12:39 AM
ATI User,
The issue was with a way I was doing some reset calculations. The logic was based on time logic instead of bar logic. Try out the latest 0.1.9. You should be able to use it in strategies now too with VWAP(Open).SD1Upper[0];.
garciaal,
You are going to need to give me a little bit more information about how you got that error. Chart type, instrument, replay? Thanks. Military time is correct. You don't need to be connected to use VWAP.
gpq,
Your suggestions have been implemented.
ATI user
03-12-2008, 07:14 AM
Josh
Brilliant. Works perfectly. Thanks
ATI user
03-12-2008, 12:32 PM
Josh
VWAP 9 continues to work perfectly in my strategy including updating tick by tick with CalculateOnBarClose = false as set by the strategy.
I notice that as in indicator in an indicator chart, it updates by bar and that setting CalculateOnBarClose = false has no effect; in fact, when you set it to false and close the parameter dialog and reopen the dialog, it has changed back to true. This does not bother me as it has no effect on my strategy...and it does save computer resources. I just thought I would report it in case you were not aware
Thanks again for a great indicator.
garciaal
03-12-2008, 04:21 PM
Josh, thanks for your reply, i got it working.
I have been going thru the post #31 for Traders Lab.
They are using this thing called PVP:
PVP refers to the peak volume price for the complete volume histogram. POC refers to the peak volume price (called Point of Control) for Market Profile, which is a 30 minute average of the volume historgram. Market Profile's POC will thus only show a slower variation of the peak volume price.
Would you or any of the experts here know how to program that?
Thanks, Al
NinjaTrader_Josh
03-12-2008, 05:24 PM
Haven't looked into it due to time constraints.
NinjaTrader_Josh
03-12-2008, 05:55 PM
ATI User,
That is the way the indicator is designed. It does not care what the user wants to do in regards to CalculateOnBarClose. In a strategy backtest it will always use CalculateOnBarClose = true. As an indicator it determines whether or not it is feasible to use CalculateOnBarClose = false. The only time it will allow that is if you loaded the indicator BEFORE the start time otherwise it will use a setting of true. This is a check to ensure that tick-by-tick weighting does not mix with end of bar weighting.
Now that I think about it though, the check was more pertinent for use with the old SD calculations. I do not have time at the moment to explore further optimizations in this regard so I will leave it as is for now.
ATI user
03-12-2008, 07:09 PM
Josh
Then I assume that using it in my strategy it also ignores the strategy setting of false and when I refresh after the open it uses estimates?
Can not tell any difference really in the values with or without refresh after the open...so it seems to be working.
Thanks
NinjaTrader_Josh
03-12-2008, 09:54 PM
It will behave exactly like how it does as an indicator alone. Being in a strategy has no influence on this matter. The estimates are fairly accurate that is why you can't really tell.
Josh, a thousand "Thanks You's" (but in only one post) for including the non-integer SD capability. Running live for the first time today with the latest VWAP (0.1.9) and noticed that it was not possible to set the "Calculate on Bar Close" to "False" and have it stick. After setting to "False," close Indicator Setup Window, VWAP does not calculate on the live bar. Reopen Setup and find that "Calculate on Bar Close," previously set to "False" is now "True." Thanks.
ATI user
03-13-2008, 11:11 AM
Josh
My strategy needs to enter on the current bar...and for that I need current vwap values.
So...I changed your code to:
//Checks to see if load time was before or after market start
else if(loadtime > Time[0] && timecheck == 1)
{
//Print("Time Check True: "+loadtime+" "+Time[0]+" "+timecheck);
estvwap = false; // true;....changed to false to generate current bar values
CalculateOnBarClose = false; // true;....changed to false to generate current bar values
timecheck = 0;
}
It seems to generate values close enough (for me) to the 'true' setting started before the open...see pic
I will advise as to further results.
Thanks for all your time we are burning on vwap
NinjaTrader_Josh
03-13-2008, 12:40 PM
Again, the reason for the complete disregard of user setting for CalculateOnBarClose was necessary in the PRIOR standard deviation calculation method (which is still available) so that is why it is still in there. I do not have time right now to further investigate implications of removing the lines of code for the newer std dev calculation methods so I am leaving it as is until later. If you guys feel like you don't need it feel free to remove it.
To give you an idea of why it was necessary in the first place, there is a counter that runs and determines how many data points are in the arrays that are storing intermediate volume and price data. When you start VWAP in the middle of the day, all previous bars of the day are run at close of the bar. That amounts to 1 count per bar, but now at the latest bar, you are incrementing tick by tick thus maybe 1000+ count for the single latest bar. You can see how quickly this outweighs all the historical bars and can bring VWAP values to a tight knit convergence when the counter is used to divide the sum of Price*Volume to find an average.
ATI user
03-18-2008, 12:06 PM
Josh
One of my friends is getting this error:
Error on calling the 'OnBarUpdate' method for indicator 'VWAPmod' on bar 0: NinjaTrader.Gui.Chart.ChartControl.GetAxisBrush(Sy stem.Drawing.Color)
VWAPmod is your code with some color changes and the change for CalculateOnBarClose = False for all conditions
Could the change cause the error? The same code is working fine in 8 of my charts on my main computer...and on my laptop.... and for others. Just the one fellow having problems.
Thanks
garciaal
03-18-2008, 01:56 PM
I,m getting error messages when I compile it in NTv6.0.
working ok in V6.5beta
NinjaTrader_Josh
03-18-2008, 04:50 PM
ATI User: VWAPmod is probably based on some really old code. I don't remember exactly, but I suggest you add a check for ChartControl in the code and see if that helps.
Maybe something like:
if (ChartControl == null)
return;
garciaal: Correct. I've migrated VWAP code to take advantage of new NT6.5 methods to streamline its painting operations. It is no longer NT6.0 compatible.
ATI user
03-20-2008, 09:10 AM
Josh
I have 2 people getting the same error now.
I added the code you suggested...no effect.
I do not understand why VWAP would work on both my computers and several others and yet generate the error on 2 others.
Anything else I can try?
Thanks.
ATI user
03-20-2008, 10:39 AM
Josh
Interesting.
The problem was that both users were running NT beta 9....all others were running NT beta 10.
Your VWAP9 works great on beta 10 as I modified for 'false' setting per below posts.
Thanks
Ricardo Salas
03-23-2008, 10:49 AM
Thanks a lot Josh for the VWAP and its Standard Deviations With this tool we can now apply the concept of trading with markets statistics.
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-i-volume-1962.html
However in order to have all the tools to apply this methodology, we need the PVP (Peak Volume Price of the Price Histogram). I noticed that NT plots the Price Histogram but without the PVP. PVP is important because its relationship with the VWAP will give us the SKEW and the direction of the market.
It would be nice to have the PVP as it was during the whole day period (I mean with its discontinuties, like a ladder) and not only the last one to see how it changed during the day.
Cheers
Ricardo
NinjaTrader_Josh
03-23-2008, 02:22 PM
Thanks for the suggestion. I will consider it in the future, but anyone please feel free to jump in and beat me to the punch.
Sartis23
04-11-2008, 05:29 PM
I have coded a slightly different approach to the VWAP concept in this indicator. Rather than use standard deviations, I have constructed a symmetrical volume area around the VWAP based on actual volume traded. The indicator also can show yesterday's VWAP as a line on today's chart, yesterday's high low, and the overnight session's high low. Finally, the indicator calculates the VWAP for the overnight session distinctly from the day session. For most people, I don't think this adds much value, but it might for some.
Also, I am about to start porting over from TradeStation a nice MarketProfile application that I wrote. I will post that when I am finished.
NinjaTrader_Josh
04-12-2008, 12:55 AM
Nice. Thanks for the enhancement Sartis23.
MichaelB
04-21-2008, 09:42 AM
Hi Josh,
I live in Australia, at present the market times are 23.30 to 6.15 (ES)
Is there any way I can set the indicator to start in one day (23.30) go thru midnight and continue plotting the lines thru till 6.15 the next day??
Thanks
Michael B
NinjaTrader_Dierk
04-21-2008, 09:56 AM
Sure. Please double check you are on latest 6.5.1000.1 and just set session begin/end on the chart properties accordingly.
MichaelB
04-21-2008, 10:52 AM
Hi Dierk,
I have version 6.5.1000.1 installed. I have a 2 minute chart with the VWAP indicator installed.
The chart properties time setting are
session begins(local time) 12.00 AM
session ends (local time) 12.00 AM
The indicator settings are
Start Time 23:00:00
End Time 07:00:00
With the above settings the indicator starts the plot at 11:00pm ( my local time ) and then stops the plot at at 12:00 midnight ( my local time)
Thanks
Michael B
NinjaTrader_Dierk
04-21-2008, 10:59 AM
Not sure I follow. You only can apply session settings on chart but not on an indicator.
If there really are time based properties on the VWAP (I have not checked), then the author would need to step in and clarify.
MichaelB
04-21-2008, 11:04 AM
Hi Dierk,
These are the settings at present, I apologize for being some what slow on the up take here, but I have no idea what you are trying to tell me
Sorry
Michael B
NinjaTrader_Dierk
04-21-2008, 12:02 PM
VWAP is not a standard NT indicator. Please contact the author of that indicator for clarification on your issue.
MichaelB
04-21-2008, 12:12 PM
Hi Dierk,
OK
Thanks
Michael B
NinjaTrader_Josh
04-22-2008, 01:26 AM
MichaelB,
Which VWAP version are you on and I am not entirely sure what the issue is. Can you post a screenshot? Thanks.
MichaelB
04-22-2008, 02:38 AM
Hi Josh,
Yes , there are many versions on the forum, the one I use is from your post #1
Last edited by Josh : 03-14-2008 at 08:13 AM.
Changelog:
1.0rc1:
- Optimized VWAP and SD calculation functions
- Removed forced CalculateOnBarClose setting for newer SD calculations
VWAP_1.Orc1 zip and appears in the indicator list as VWAP (volume weighted average price)
Under settings : Start Time 00:00:00
End Time 00:00:00
I had been changing these settings in am attempt to have the indicator start on one day move thru midnight and stop on the next day, As indicator settings appear to have priority over , the Price Chart ,Property settings. But in this indicator, this is not the case
So as Dierk pointed out NT version 6.5 chart property settings allows you to set indicators over two days. Leaving the default setting of the VWAP indicator , as above,
and changing the default setting of the chart property session times from
session begins (local time ) 12:00 AM TO 11:00 PM
Session Ends ( local time) 12:00 AM TO 11:00 PM
see,s to have obtained the result
I will know for sure tonight ( my time)
Thanks for feedback as usual
Michael B
NinjaTrader_Josh
04-22-2008, 02:49 AM
The VWAP time settings have not been designed to allow for this crossing of the session times like that. Let me know if setting the chart settings works out. I think it should.
nasdaq5048
05-01-2008, 07:52 PM
How do we get a monthly vwap? It would be helpful if we can get the VWAP to reset monthly instead of daily. Can anyone tell me how to modify the code to do that? Thanks
NinjaTrader_Josh
05-02-2008, 03:40 AM
The code isn't simple to explain and I am not going to do updates on this right now due to time constraints. If anyone else in the community wants to dive in and re-release it feel free to do so with any enhancements/changes.
nasdaq5048
05-03-2008, 02:41 PM
The code isn't simple to explain and I am not going to do updates on this right now due to time constraints. If anyone else in the community wants to dive in and re-release it feel free to do so with any enhancements/changes.
Is it possible to just change the Bars.SessionBegin.Month in the line starttimedate = new DateTime(Bars.SessionBegin.Year..........)??
NinjaTrader_Josh
05-03-2008, 02:49 PM
Unfortunately it would take more than that to get it to work.
Why does this indicator only work intraday?
NinjaTrader_Josh
06-09-2008, 09:42 PM
Because the VWAP concept this indicator satisfies is for the intraday VWAP.
ATI user
06-20-2008, 10:49 AM
Josh
I notice that VWAP does not reset on the Open of a 20 range chart.
I had the session times at 9:30 9:30 and changed them to 9:30 9:00 which worked some of the time.
Again this morning it did not reset...so I reset the chart manually.
I note that it resets for time, tick and volume charts.
Any thoughts?
Thanks
NinjaTrader_Josh
06-21-2008, 12:37 PM
Never designed with range charts in mind before so I have no idea. If I remember correctly all of the logic was done via timestamps and session begin/end checks. There could easily be a number of situations not addressed in terms of range bar charts causing the failure in reset.
ATI user
06-21-2008, 02:00 PM
ok thanks
is there a way to reset an indicator on the open from within the strategy?
or perhaps Add VWAP on the Open would work?...would need to remove the old one tho or they would stack up pretty quick
NinjaTrader_Josh
06-21-2008, 02:28 PM
There is no built in functionality to do so. Feel free to tweak it yourself to work as desired.
ATI user
06-21-2008, 03:08 PM
right thanks
I meant does Ninjascript (not VWAP) have code/instructions for removing an indicator or resetting one?
NinjaTrader_Josh
06-21-2008, 06:31 PM
Unfortunately there is no reference sample for this. We do not support removing and adding, but what you can do is resetting all variables within the indicator and that will produce the result you want.
ATI user
06-22-2008, 09:26 AM
thanks Josh
tried all that...several times and several ways
can not get a decent/accurate open on a 20 range...i.e. Bars.FirstBarOfSession is useless
decided to not run VWAP.cs in a range chart...I run it in a 1 min and a 1000 vol and it works fine...
NinjaTrader_Josh
06-22-2008, 12:58 PM
Right. Consider it a limitation for the indicator right now since it was built back in the days when we didn't have range bars.
ATI user
06-22-2008, 02:02 PM
Yes. The limitation however I believe is with NT range charts...not with VWAP.cs
The Bars.FirstBarsOfSession not working with volume charts and range charts has been driving me nuts for several weeks now.
I solved the problem in my strategy by adding a 1 min series and picking up the 'real' first tick of the first bar that way. Works perfectly in a strategy.
Looks like I solved the problem in volume charts by using 9:30 9:29 session times.
However, you can not add an additional series to an NT Indicator and the session time trick does not work with range charts...so...can not use indicators that depend on first tick of first bar in range charts.
Really annoying actually. I still think that this range bar limitation should be corrected...i.e. if you have session times of 9:30 AM 4:00 PM for instance then the first range bar should start at exactly 9:30:01 and not look back at data prior to the open to fill the range before startig a new bar (FirstBarOfSession)
NinjaTrader_Josh
06-22-2008, 04:29 PM
I will run some tests to see what is going on.
dwt1020
07-12-2008, 12:46 PM
Has anyone tried this and or using this method?
Any feedback?
thanks in advance
david
NinjaTrader_Josh
07-12-2008, 02:22 PM
Hi David,
Try what? The VWAP indicator is 100% functional on all chart types except for Volume and Range bars. The limitation right now is in real-time Volume and Range bars. If you run it in approximation mode (load after market start) you should have no problem with Volume/Range charts also.
dwt1020
07-12-2008, 03:04 PM
Sorry, I assumed this indicator was created to be used for and by users
wanting to try this method from another forum...
My question was in reference to users using this indicator to trade this method...
Another question.. is there an indicator here that will plot the High volume price? I am not a coder, but wouldn't think it would take much to add it..
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-i-volume-1962.html
thanks for the response..
d
NinjaTrader_Josh
07-12-2008, 03:38 PM
This indicator was developed by me on my free time and is definitely up for use by anyone. In TL there is actually a thread where the method is discussed with a few fairly interesting flash videos. They were using an older version of the indicator, but can still be useful for you.
http://www.traderslaboratory.com/forums/24/playing-with-the-vmar-s-open-2440-69.html#post24865
Check out walterw's videos.
In regards to the other indicator, I am unaware of any that have been made. As a last resort you could try contacting a NinjaScript Consultant here: http://www.ninjatrader.com/webnew/partners_onlinetrading_NinjaScript.htm
calibri
07-18-2008, 09:37 PM
@david
there is the market delta tool from fin-alg which plots the high vol. price. with his market profile tool you get the plot too, but not highlighted.
http://www.fin-alg.com/product.html
have a nice weekend
c.
ATI user
08-22-2008, 03:54 PM
Josh
Any chance VWAP could be made to run in Strategy Analyzer?
I use it in most of my strategies and can not use SA. When I run a configuration that does not access VWAP, then SA runs fine.
Any ideas?
Thanks.
NinjaTrader_Josh
08-23-2008, 03:16 AM
I can put it up for a future fix, but I won't be working on it in the near future yet.
ATI user
08-23-2008, 07:35 AM
thanks Josh
it will save me hours/days of doing market replay instead
fy260498
08-29-2008, 02:00 AM
Hi JOSH,
This is Yusuf, wanted to initially thank you for your work on VWAP. I had been exploring the use of VWAP lately and my target is ES. I try to creat a band of VWAP by using and monitoring VWAP after every 1 hour thereby creating a band of about 14 individual VWAP. I am facing a problem in this. I know that it is far too much for me to ask my PC to do but as expected the chart freezes at the time of aggressive trading and therefore I decided to make the original code slightly simplified. Now, what I am planning to do is to eliminate the SD calculations and the Bands from this indicator. I may just be looking at the main VWAPLine and thats all I want. Is that possible to achieve??? I tried modifying this indicator to suit my need but all my efforts failed. Could you help me in this, if possible of course. Somehow I am trying to put lesser calculations so that NT does not hang. Also, let me know how can I post and where to post any indicator, if I am able to build one for the use of NT Trader's Community and what permissions do I need before posting as this may be my first ever indicator on NT Forum, if I am successful in creating it.
Thanks for your reply.
Best regards,
Yusuf SHAIKH
NinjaTrader_Josh
08-29-2008, 02:43 AM
There should already be properties in place that eliminate the std dev stuff. Just cut out those if statements along with the code inside them. You can post whatever spinoff of this indicator you make in the File Sharing section.
fy260498
08-31-2008, 01:01 AM
Hi Josh,
Thanks for your reply. Actually I had been doing what you said since last week and could not achieve desirable result and keep getting error each time. So this time I decided to eliminate the codes, line by line and then check the eroor message on compiling and then I try to resolve it. So by doing this I could finally manage to achieve what I wanted (I think so...:confused:). However there is something very interesting. Just look at the following lines from the Initialize zone of the code.
Add(new Plot(Color.Maroon, "VWAP"));
Add(new Plot(Color.Blue, "VWAP Upper Band"));
Add(new Plot(Color.Blue, "VWAP Lower Band"));
Now I deleted the last 2 lines as I did not want VWAP Bands to be plotted and only VWAP Line. Compiled the codes and it was fine. Now when I try to load this indicator on the chart, I selected the indicator, set the BreakTime and clicked on "Apply" button and the VWAP line was loaded on the chart. But the moment I clicked on "OK" button to close the Indicator Menu, the VWAP Line just disappeared. I then restored both the last 2 lines in the code and the VWAP Line was fine even after closing the Indicator Menu. I am abit confused as what is driving this indicator to behave in this way.
My second issue is, I am still not able to figure out as what lines in the code is actually causing the plot of VWAP Line on the chart.
Check the following lines from the OnBarUpdate codes:
volumearray.Add(tickvolume);
pricearray.Add(Close[0]);
VWAPLine.Set(vwap(volumearray,pricearray,count));
vwaparray.Add(vwap(volumearray,pricearray,count));
vwapsum = vwapsum+vwap(volumearray,pricearray,count);
vwapavg = vwapsum/count;
I thought it is the one BLUE is color in the above code but still am confused, kindly help.
Finally, I just wanted to check if it is possible to compare VWAP[0] with VWAP[1], I mean comparing bar by bar values of VWAP like I was able to do it for EMA(80)[0] with EMA(80)[1]. If this is possible, then let me say...IT IS GOING TO BE WONDERFUL, JUST WONDERFUL. I tried doing this but was not able to feed the input parameters for VWAP which is TimeSpan BreakTime. I think you may be able to help me out in this, if its possible.
I am asking for your help only after spending a lot of time on this VWAP Indicator that promises a lot of potential and secrets hidden within. Honestly speaking, I don't want to trade without it and therefore I strongly belive that every day that I spend in understanding the best way to use it, my excitment level increases by time.
Lets see if you have any solution for these issues that will be highly appreciated.
Thanks & best regards,
Yusuf SHAIKH
NinjaTrader_Josh
08-31-2008, 01:23 AM
Yusuf,
I cannot go through the code line by line to figure these out due to bandwidth issues to figure out why you cannot remove the Add() lines. But try this: please expand the Properties region of the code to find the plots associated with the Add() lines. You need to remove those plots along with the Add() lines.
Find the VWAP plot for the line and find out its plot name. Then go to the code and find the .Set() for that plot. That is the single line of code doing what you see on the charts.
It is possible to compare current VWAP with previous VWAP. Just make sure you call the it properly. VWAP()[0]. You may need to fill in some parameter settings inside the paranthesis. I don't recall.
fy260498
08-31-2008, 01:59 AM
Hi Josh,
Thanks for your reply....
It is possible to compare current VWAP with previous VWAP. Just make sure you call the it properly. VWAP()[0]. You may need to fill in some parameter settings inside the paranthesis. I don't recall.
The parameter required inside the paranthesis is BreakTime in the form 00:00:00 and once fed, the code shows error. Any idea ??? Is there another form of input, probably ???
This is what I tried:
if (VWAP(00:00:00).VWAPLine[0] > VWAP(00:00:00).VWAPLine[1])
//Do Something//
The error lines are seen below 00:00:00
Thanks,
Yusuf SHAIKH
NinjaTrader_Josh
08-31-2008, 04:15 AM
Try creating a new DateTime first and then passing it into the parameter list. Off the top of my head I think it was this: new DateTime(0, 0, 0). Please check the IntelliSense for the proper syntax.
fy260498
08-31-2008, 05:29 AM
JOSH...
Great Man...
Just wonderful...
I finally got it Buddy...
Thanks for your lines of info.
The only thing left now is testing it when the market is open and I just wish it does not crash, I am scared, wish me LUCK...
You see I am not a Programmer, I know how to download movies, how to rip them, how to enhance audio and video quality, everything related to multimedia, lot of things related to software as apart from being an Engineering Graduate (Automobile Engg), I also completed my Diploma in Software Engg but forgot all the programming concepts as being out of touch. Inspite of these things there were 2 main reasons why I could manage to get the Indicator (VWAP) the way I wanted it.
# 1 - Great Support from this man named JOSH
# 2 - I have a wife, 2 kids and my Mom and Sisters to look after and trading is the only way through which I earn my bread and butter. I just cannot cheat with it, cannot afford it.
Thank you very much once again for your kind support man. I have also posted some of my views on Traders Laboratory regarding this wonderful indicator VWAP and at the moment I am in touch with Walter as together we are in the process of building up a sound trading strategy for ES that will be reasonable to try, God Willing.
My sincere thanks once again to you Josh and also to Walter from Traders Laboratory and would suggests all the readers at NT to atleast have a look at the wonderful research going on at TL by Walter and others.
Best regards,
Yusuf SHAIKH
NinjaTrader_Josh
08-31-2008, 02:47 PM
Yusuf,
Thanks for the kind words. I really appreciate it. You just made my day. :D
ATI user
09-11-2008, 02:46 PM
Josh
I have been working on your VWAP code to try to revise it so VWAP will work in Strategy Analyzer.
During the process, for use in another strategy, I was wondering if it is possible to set the TimeSpan variables to a default.... ie. the same way that you would set the default for any other input parameter.
Your relevant code is:
private TimeSpan startTime;
private TimeSpan endTime;
Also, am I assuming correctly that NT does not allow Settings in the Properties section in strategies while it does allow it in indicators? And why when put in a strategyis a TimeSpan parameter not in alphabetical order in the parameter list? Works great...just curious.
Your relevant code is:
[Description("VWAPmod Start Time")]
[Category("Settings")] <---------- I had to change this to Parameters to work in my strategy
[Gui.Design.DisplayName("\t\t\t\t\t\tStart Time")]
public TimeSpan StartTime
{
get { return startTime; }
set { startTime = value; }
}
Thanks
ATI
NinjaTrader_Josh
09-11-2008, 04:17 PM
Hi ATI User,
You should be able to create user definable variables in the Properties region of your strategy without any problems. Perhaps "Settings" is reserved (not sure). Try a different name. The ordering I used was just whatever felt more natural to me. Change it however you see fit.
In terms of setting the default for a TimeSpan, you should be able to do that as well. Give this a try. It might work.
private TimeSpan startTime = new TimeSpan(0, 0, 0);
ATI user
09-11-2008, 05:00 PM
thanks Josh....great service and knowledge as usual
I will try those ideas
thanks also for replying to this thread on DateTime in market replay
http://www.ninjatrader-support.com/vb/showthread.php?t=10019
I believe that is the reason that VWAP will not run in Strategy Analyzer. I tried to comment out the time sections in VWAP to get around it however no luck so far...will advise
Everything I do now in my strategy and trading is now based on your VWAP...so I can not thank you enough for writing up the code.
NinjaTrader_Josh
09-11-2008, 05:11 PM
Wait a minute. How are you trying to access it in the SA?
Attached is a very crude strategy. The included version of the VWAP is slightly different in that it requires you to input the startTime and terminalTime (renamed from endTime) so overwrite it only after you backup what you already have.
You will find that the prints are able to acquire the correct value from both VWAPs in the SA. Only problem is that the VWAP continues to print values even for the particular VWAP that has been time limited. You can sidestep this problem with your own time filters corresponding with the time filters in place for the VWAP. Unfortunately this is all I can do for now. You will just have to play with it yourself.
ATI user
09-11-2008, 06:38 PM
Hi ATI User,
You should be able to create user definable variables in the Properties region of your strategy without any problems. Perhaps "Settings" is reserved (not sure). Try a different name. The ordering I used was just whatever felt more natural to me. Change it however you see fit.
In terms of setting the default for a TimeSpan, you should be able to do that as well. Give this a try. It might work.
private TimeSpan startTime = new TimeSpan(0, 0, 0);
Tested changing from 'Parameters' to another name not Settings and it just does not show up. Tried the other categories and it appears to be restricted to using General or Parameters...which is fine.
Re order, my Properties section is totally random and yet gets listed alphabetically ...except for the 2 new TimeSpan variables which list on the top...strange. Re your order, maybe Indicators list based on order in Properties section?
Re private TimeSpan startTime = new TimeSpan(0, 0, 0); ...works like a charm. Thanks.
ATI user
09-12-2008, 04:30 AM
Wait a minute. How are you trying to access it in the SA?
Attached is a very crude strategy. The included version of the VWAP is slightly different in that it requires you to input the startTime and terminalTime (renamed from endTime) so overwrite it only after you backup what you already have.
You will find that the prints are able to acquire the correct value from both VWAPs in the SA. Only problem is that the VWAP continues to print values even for the particular VWAP that has been time limited. You can sidestep this problem with your own time filters corresponding with the time filters in place for the VWAP. Unfortunately this is all I can do for now. You will just have to play with it yourself.
I am accessing VWAP in SA via my cs...which runs fine for all options except those requiring VWAP....so I assumed that the VWAP would not run in SA.
Thanks for the new zip. I assume the print problem is the values printed prior to 11:00 for the second VWAP (see pic)? Is this not just because the print statement calls for the values prior to 11:00?...and VWAP is making them up prior to its session open? If not, then I am not sure what you mean....please explain further.
For my purposes, which is just to get accurate values from the 9:30 open, I assume that this new version will work fine. Please let me know if I am missing anything. My intention is to just recode my strategy to pass session times to the new VWAP version and then run in SA. Should work.
Thanks again for the code and your time.
NinjaTrader_Josh
09-12-2008, 09:08 AM
ATI user,
Placing properties outside of "Parameters" is not supported so if it doesn't work then it doesn't work.
The ordering of properties is always alphabetical. The reason the TimeSpan ones go to the front is because they have \t characters at the front which are recognized as before the letter A.
As far as playing with the returned values, you will just need to explore it yourself. I think you have the right idea, but I cannot spend time to further examine the limitations and what not of the indicator.
ATI user
09-12-2008, 09:35 AM
ATI user,
Placing properties outside of "Parameters" is not supported so if it doesn't work then it doesn't work.
The ordering of properties is always alphabetical. The reason the TimeSpan ones go to the front is because they have \t characters at the front which are recognized as before the letter A.
As far as playing with the returned values, you will just need to explore it yourself. I think you have the right idea, but I cannot spend time to further examine the limitations and what not of the indicator.
right...works fine in "Parameters" ....or "General" for that matter it seems
right...makes sense...did not think of the "\"
the returned values work fine (in SA also)...so VWAP.cs is perfect now from my standpoint....thanks..
my only remaining problem is in my cs..... "new DateTime(... " is picking up yesterday instead of today....no matter where I put the code in my cs...I am running on live data so DateTime.Now and new DateTime should be the same date (please see pic)...what could cause that?...thanks again
NinjaTrader_Josh
09-12-2008, 09:49 AM
You will need to check your Bars.SessionBegin.
Pepperdog
10-12-2008, 01:07 PM
Can anyone provide any hints how this indicator might be modified to also plot an additional line indicating the skewness?
For example:
...
SkewOfData = volwap + Skewness(DataSet);
SkewLine.Set(SkewOfData);
...
Per Wikipedia skewness is defined as the 3rd moment about the mean / Std. Deviation^3 in case anyone was curious.
Is there a C# function to calculate the skewness of a data set? Maybe it is this simple, but I am in the dark here with little C# experience.
Thanks!
Pepperdog
10-22-2008, 05:49 AM
Had anyone tried this indicator with RangeAlt bars?
It seems to work fine with the stock Range bars, but not with RangeAlt. Any ideas why?
Thanks,
J
NinjaTrader_Josh
10-22-2008, 09:19 AM
Pepperdog,
This indicator was developed as a 3rd party indicator on my own time. Unfortunately due to time constraints I cannot further development on this at this time.
ATI user
10-25-2008, 11:59 AM
Josh
I am trying to pass a new session time from my cs to your session time based vwap indicator.
When I run the chart in replay through the new time (i.e. not the chart properties session start time of 9:30 but rather the manually input start time of 9:36), the VWAP does not start plotting unless I refresh the chart AFTER 9:36 (then is works perfectly). Why is this?
Thanks.
NinjaTrader_Josh
10-27-2008, 09:06 AM
Unfortunately I don't follow ATI user.
ATI user
10-27-2008, 12:12 PM
sorry Josh
I want to start VWAP at 9:36 AM...so I set the session start time in VWAP to that time.
I then start Market Replay from 9:30 AM. When 9:36 AM arrives, VWAP does not start plotting. If I refresh after 9:36 AM it starts the plot properly from 9:36 AM.
I have not tested on live data feed. Could Market Replay be the problem (as it does not always use chart time)?
The only way so far I have been able to have VWAP start at the 9:36 AM time is to set that session start time in Chart Properties...then no problem. However I want to have my cs set the time while running live...rather than manually setting the chart session start time
NinjaTrader_Josh
10-27-2008, 12:26 PM
I see. Unfortunately this may be a limitation at this point in time.
higler
12-29-2008, 10:00 AM
VWAP is a great tool. I have a couple of questions:
1. How do the Session begins/ends times in chart properties and the VWAP Start/End time settings interact? I dont want to inadvertently hose up the indicator with incompatible settings.
2. Does anybody have any recommendations on the chart properties times and the VWAP Time settings? The "official" eMini futures sessions run from one afternoon to the next crossing the midnight barrier. Is it better to run VWAP according to the "official" eMini futures session times (afternoon to afternoon) or according to the "main" market times (9:30 a.m. ET to 4:00 P.M. ET)?
Any recommendations would be appreciated. Thanks.
NinjaTrader_Josh
12-29-2008, 10:04 AM
1. VWAP start/end times should be inside the chart's session end time. You can play with it to see how it behaves.
higler
12-29-2008, 12:16 PM
Thanks. It works great. When I change my VWAP settings start/end times everthing works fine. I saved my workspace. Then when I later start up NT again and open my workspace my VWAP settings start/end times are back to 00:00:00. Am I messed up? It's no problem reentering the times, but it woud be nice if thise settings were saved. Am I missing something? Thanks.
NinjaTrader_Josh
12-29-2008, 12:23 PM
highler,
It may be a bug. Since this was made as a third party indicator and development on it has stopped for awhile now, I just do not have time right now to check into it.
higler
12-29-2008, 12:29 PM
OK. I can certainly use it the way it is. Everyone appreciates your enormous contributions to this forum.
greatsky
04-01-2009, 08:44 PM
Which post will have the latest .zip file for this indicator? Thanks!
NinjaTrader_Bertrand
04-02-2009, 06:37 AM
You can use this link from our sharing section - http://www.ninjatrader-support2.com/vb/local_links.php?action=jump&id=71&catid=1
tjendra
05-11-2009, 10:28 AM
Josh, I want to use the SD of VWAP in a strategy. Can I call the values using statements shown below?
VWAP().SD1Upper[0] or VWAP().SD1Lower[0].
But the SD1 as called above will be default as 1 SD. If I want to use multiplier such as 1.5 SD for SD1Upper[0], how can I do this from within strategy?
NinjaTrader_Josh
05-11-2009, 10:34 AM
You will have to go to the indicator and make changes to allow this to happen.
Go to the Properties region of the code:
[Description("Std Dev 1 Multiplier")]
[Category("Plots")]
[Gui.Design.DisplayName("\t\t\tSD1 Multiplier")]
public double SD1Multi
{
get { return sd1Multi; }
set { sd1Multi = value; }
}Change Category to Parameters instead of Plots. Then you can do VWAP(1.5).SD1Upper[0].
mea109
05-12-2009, 10:47 AM
hello gentlemen
thank you for your work
great
dj22522
05-23-2009, 07:55 AM
Thanks a lot Josh for the VWAP and its Standard Deviations With this tool we can now apply the concept of trading with markets statistics.
http://www.traderslaboratory.com/forums/f6/trading-with-market-statistics-i-volume-1962.html
However in order to have all the tools to apply this methodology, we need the PVP (Peak Volume Price of the Price Histogram). I noticed that NT plots the Price Histogram but without the PVP. PVP is important because its relationship with the VWAP will give us the SKEW and the direction of the market.
It would be nice to have the PVP as it was during the whole day period (I mean with its discontinuties, like a ladder) and not only the last one to see how it changed during the day.
Cheers
Ricardo
Very helpful thread, thank you..
Can anyone assist with PVP as mantioned above ?
Many thanks...
greatsky
05-23-2009, 08:02 AM
Would someone please post the latest version of the VWAP indicator? Thanks!
NinjaTrader_Bertrand
05-23-2009, 08:05 AM
You can find it here - http://www.ninjatrader-support2.com/vb/local_links.php?action=jump&id=71&catid=1
hegh2000
06-11-2009, 06:00 PM
hello,
Here is a multi-day VWAP.
The parameter:
daysLookBack: if = 1 for only 1 day LookBack (Today + Yesterday), otherwise it goes back all the days that value.
adrien
hegh2000
06-12-2009, 02:40 AM
Hi warrior,
I corrected my previous message.
daysLookBack: if = 1 for only 1 day LookBack (Today + Yesterday).
If you are looking for a version 1 day
using the standard version or iVWAP1J.
tastudios
06-18-2009, 11:31 AM
If anyone needs a PVP (Peak volume price) indicator, there is one in the filesharing section.
dj22522
06-19-2009, 09:31 AM
If anyone needs a PVP (Peak volume price) indicator, there is one in the filesharing section.
This is excellent, thank you.
I've posted in this thread,
http://www.ninjatrader-support2.com/vb/showthread.php?p=101263#post101263
Post #5 hopefully explains what I'm trying to get on a chart.
Don't wish to complicate my request by also posting here but the two are so inter-related.
I'm assuming is it showing the PVP for the current day in real time, so that it updates to the most recent price with highest volume.?
Can your PVP indicator be adjusted to do what I've asked about on above link ?
ie: Have the PVP for current day/previous day/current week/previous week/previous month as separate lines?
And for each line to extend to the current live price bar ?
Many thx..
tastudios
06-30-2009, 01:32 PM
The dValueArea indicator already does what you ask, i.e. plots a seperate line for the PVP on each day. To get the pvp, change the indicator's setting from TPO to VOC. The PoC then is the same as PVP.
I don't think that dValueArea works with intra-day data though.
This is excellent, thank you.
I've posted in this thread,
http://www.ninjatrader-support2.com/vb/showthread.php?p=101263#post101263
Post #5 hopefully explains what I'm trying to get on a chart.
Don't wish to complicate my request by also posting here but the two are so inter-related.
I'm assuming is it showing the PVP for the current day in real time, so that it updates to the most recent price with highest volume.?
Can your PVP indicator be adjusted to do what I've asked about on above link ?
ie: Have the PVP for current day/previous day/current week/previous week/previous month as separate lines?
And for each line to extend to the current live price bar ?
Many thx..
laredo
08-05-2009, 02:46 PM
Can someone tell me on this indicator what the blue bands and assiciated highlighter prices are?
NinjaTrader_Josh
08-05-2009, 02:51 PM
Standard deviation bands from the VWAP.
RomanFx
08-10-2009, 01:22 PM
Please update to Release Candidate 1 (3/14/2008)
You can choose at what time to start VWAP calculations and when to end them.
I have put the VWAP on 24 hour tick charts S&P 500 futures (eminis) with time selected for the Regular Trading Hours (RTH) 7:30am Mountain Standard Time (MST) to 2:15pm MST the indicator worked very well.
The indicator failed to plot when I have changed the start time to the opening of electronic trading session at 14:30pm and ending at the closing of RTH at 14:15pm
I have played around the Chart Properties for start time and end time, it did not seem to make a difference.
Is there a way arund this problem?
What do you advise i should do?
NinjaTrader_Josh
08-10-2009, 01:32 PM
Unfortunately this was not coded to work with session end times that are the next day and numerically before the start time.
RomanFx
08-10-2009, 06:29 PM
I have put the VWAP on 24 hour tick charts S&P 500 futures (eminis) with time selected for the Regular Trading Hours (RTH) 7:30am Mountain Standard Time (MST) to 2:15pm MST the indicator worked very well.
The indicator failed to plot when I have changed the start time to the opening of electronic trading session at 14:30pm and ending at the closing of RTH at 14:15pm
I have played around the Chart Properties for start time and end time, it did not seem to make a difference.
Is there a way arund this problem?
What do you advise i should do?
My understanding now is that the indicator is not coded to work with session start times located in previous day.
Could someone please help me with the code, to make this thing work? PLEASE. I would greatly appreciate the help.
NinjaTrader_Bertrand
08-11-2009, 06:11 AM
RomanFx, as a last resort for this modification you could contact a NinjaScript consultant - http://www.ninjatrader.com/webnew/partners_onlinetrading_NinjaScript.htm
marketmasher
08-12-2009, 03:37 PM
My understanding now is that the indicator is not coded to work with session start times located in previous day.
Could someone please help me with the code, to make this thing work? PLEASE. I would greatly appreciate the help.
I'm not good with the DateTime stuff - what I would do is covert the time to integers using ToTime(Time[0]) and then substitute the conditions where it is referencing the DateTime variables in the code, accounting for 160000 to 240000 and then 0 to 93000.
laredo
08-14-2009, 10:15 AM
I adjusted teh vwap setting to remove lines on the chart and saved template as(named it)
the setting I made on the vwap itself did not remain.
HOw do I retain them?
NinjaTrader_Josh
08-14-2009, 10:19 AM
Could be erroneous programming in it causing it to not save.
dj22522
09-17-2009, 06:41 AM
Edit:
Thought it best to start new thread:
http://www.ninjatrader-support2.com/vb/showthread.php?p=115525#post115525
Greetings.
I'm posting this if anyone is able to convert it to NinjaTrader.
Attached is a Metatrader screen shot showing volume levels and histogram for day/week/previous week/month/total contract.
These are downloaded from the CME each night via this site:
http://trading-evolution.com/
The CVS files are saved into Metatrder via this eVolution indicator from this thread (as from about post # 241)
http://www.forexfactory.com/showthread.php?t=126216&page=17
You then convert them (I'm using 7-zip) from rar to cvs files and then apply the indicator to the chart.
The OP (Volume Trader) suggested posting this excel link for anyone wanting to convert this:
http://trading-evolution.com/temp/evolution-levels-6EM9-with-explanation.csv
Ok that's about as much as I know.
Hoping it is of interest and tht some capable person can/wants to convert it.
Many thx
hegh2000
09-17-2009, 04:48 PM
hello,
version (Custom) weekly.
have fun.
adrien
koganam
10-04-2009, 04:12 PM
Write the code so that if the starttime is (apparently) after the endtime, then one day is subtracted from the starttime.
For example:
DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 16, 30, 0, 0).AddDays(-1)
will make the time 1630 yesterday.
My understanding now is that the indicator is not coded to work with session start times located in previous day.
Could someone please help me with the code, to make this thing work? PLEASE. I would greatly appreciate the help.
paulg
10-11-2009, 12:21 PM
For example:
DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 16, 30, 0, 0).AddDays(-1)
will make the time 1630 yesterday.
Do you mean this change of the code set 1630 yesterday as starting session time?
mea109
10-13-2009, 05:35 AM
I like the potential in this, so I've created an indicator to trigger trades.
If you have 2 consecutive candles that close outside the VWAP bands AND the the volume is rising then you get a different colour dot.
I think its probably best to only take the first trade in the day and to have good money management, but I'm still playing with it, so anyone please let me know of any related strategy.
http://www.acuclick.net/VWAP_Trig.jpg
To import:
- Download the file contained in this thread to your desktop
- From the Control Center window select the menu File > Utilities > Import NinjaScript
- Select the downloaded file
hello has anyone succeeded in installing the VWAP indicator trigger?
thank you
enochbenjamin
10-25-2009, 09:15 AM
I plan on giving it a shot tonight. I'll let you know then.
e.
T2020
10-25-2009, 08:19 PM
hello,
version (Custom) weekly.
have fun.
adrien
The weekly appears to start at zero as it were once a week , while the one
where you set the look back gives a continuous flow of smooth lines . They
both give good levels ,but there's a limit to the number of lines I want on the chart . That's the problem with a bunch of different versions . which one do
you use ???
enochbenjamin
10-26-2009, 12:30 PM
hello has anyone succeeded in installing the VWAP indicator trigger?
thank you
not working - it looks like this trigger indicator is older than the underlying vwap indicator.
mea109
10-26-2009, 01:20 PM
merci enochbenjamin (http://translate.googleusercontent.com/translate_c?hl=fr&ie=ISO-8859-1&langpair=auto%7Cfr&u=http://www.ninjatrader-support2.com/vb/member.php%3Fu%3D14075&tbb=1&rurl=translate.google.fr&usg=ALkJrhi-224i0SismbIlzDTp3ptLEXOmxg)
hegh2000
10-26-2009, 05:58 PM
The weekly appears to start at zero as it were once a week , while the one
where you set the look back gives a continuous flow of smooth lines . They
both give good levels ,but there's a limit to the number of lines I want on the chart . That's the problem with a bunch of different versions . which one do
you use ???
hello,
I do not use this version on Intraday. But just to see the open or close position relative to VWAP (or SD) of last week, or progression of VWAP (or SD) compared to those of last week.
For the Daily, I use the version with daylookback.
T2020
10-27-2009, 07:54 AM
hello,
I do not use this version on Intraday. But just to see the open or close position relative to VWAP (or SD) of last week, or progression of VWAP (or SD) compared to those of last week.
For the Daily, I use the version with daylookback.
I see . Thank you for the insight .
JackWittaker
10-27-2009, 12:45 PM
Anyone care to add sound alert functionalities to this indicator that will allow for the capabilty to set alerts based on the attributes listed on post 16 of this thread?
http://www.ninjatrader-support2.com/vb/showthread.php?p=123088#post123088
Good trading
T2020
11-01-2009, 11:45 AM
Please update to Release Candidate 1 (3/14/2008)
VWAP and its standard deviations. You can choose at what time to start VWAP calculations and when to end them.
Note: You can only use this indicator on intraday charts.
http://i29.tinypic.com/11l7l88.jpg
ot
I'd like to try this at different start times ,but the only way I can get it to plot is to leave it as it's default setup . Everything set to Zero . Otherwise
it just doesn't plot anything ???
rretch
11-01-2009, 08:56 PM
T2020,
You can try using the Midas Indicator (which is a VWAP plot). This zip file has the Midas (EOD) and iMidas (intraday) indicators -which you can plot at any times you would like.
You will not have SD's though. You may find that plotting more than one Midas line helps more than SD's from VWAP.
www.ninjatrader.com/SC/September2008SC.zip (http://www.ninjatrader.com/SC/September2008SC.zip)
Hope it helps.
-robert
I'd like to try this at different start times ,but the only way I can get it to plot is to leave it as it's default setup . Everything set to Zero . Otherwise
it just doesn't plot anything ???
T2020
11-01-2009, 09:56 PM
T2020,
You can try using the Midas Indicator (which is a VWAP plot). This zip file has the Midas (EOD) and iMidas (intraday) indicators -which you can plot at any times you would like.
You will not have SD's though. You may find that plotting more than one Midas line helps more than SD's from VWAP.
www.ninjatrader.com/SC/September2008SC.zip (http://www.ninjatrader.com/SC/September2008SC.zip)
Hope it helps.
-robert
I'm having the same problem with the iMidas as I did before . I wanted to start the plot at midnight ,so I set the start and end times to 12:00:00 .
I'm in PS Time ,if that makes any difference ,with my chart session times
set to 6:30 . I must be missing something simple . It must work for other people ???
paulg
11-02-2009, 05:50 AM
I'm having the same problem with the iMidas as I did before . I wanted to start the plot at midnight ,so I set the start and end times to 12:00:00 .
I'm in PS Time ,if that makes any difference ,with my chart session times
set to 6:30 . I must be missing something simple . It must work for other people ???
Maybe the trick described at post #169 could help?
T2020
11-02-2009, 08:09 AM
Maybe the trick described at post #169 could help?
Thanks . I was able to get it to plot by altering the start and end times while
adding the indicator to the chart , but not all settings seem to work . I'm not
sure if this is what was suggested or something in the code of the indicator was suppose to be changed . That said , I'm using the Weekly and days look
back versions with better usefulness ,so I think I'll just stick with them .
Thanks again - all .
Ricam
11-10-2009, 03:48 PM
I am a novice programmer trying to update the VWAP indicator to work with NT7. I have found this to be a very useful indicator.
As originally written for NT6.5, VWAP gets the Year, Month, Day, Hours Minutes and Seconds from properties of the SessionBegin object which is not supported in NT7. In NT7 we have the Session.SessionsOfDay object which does not seem to have all of these properties from what I can tell in the Help file.
Therefore would appreciate if someone could kindly explain how to get the Y, M, D, Hr, Min, Sec for the beginning and end of the session in NT7. Thanks in advance.
hegh2000
11-10-2009, 04:00 PM
hello,
I have no NT 7. Does this indicator works on NT 7 or not?
Are all indicators developed on version 6.5 should be changed?
NinjaTrader_Josh
11-10-2009, 04:07 PM
Session.SessionsOfDay contains BeginTime and EndTime which is enough information to mimic the old logic.
superarrow
11-11-2009, 08:49 PM
Currently, VWAP always starts and ends at chart based Session begin and end times, in my case from 12am to 12am. I tried to change the times on the template but reverts back to its code settings.
So I tried to apply the following logic in OnBarUpdate for session times of the instrument of interest such as:
if (Instrument.MasterInstrument.Name == "ES")
{
startTime = new TimeSpan(08,30,00);
endTime = new TimeSpan(15,15,00);
}
This works but now I am faced with a new issue: In Tick and Vol based charts, the chart is compressed to about five bars long for the defined TimeSpan, no matter what period you set. The chart displays as expected outside the TimeSpan period.
However, there is no problem in Time based charts - charts show up as expected.
What am I doing wrong?
SA
NinjaTrader_Josh
11-12-2009, 08:10 AM
I guess I don't quite follow. Perhaps a screenshot will clarify.
T2020
11-12-2009, 01:31 PM
I guess I don't quite follow. Perhaps a screenshot will clarify.
I'd like to make a small edit to your indicator . When the start and end times
are all set to zero , then the indicator starts to plot at what ever session start or end time you have the chart set to . Would it be possible to edit it by just adding 30 mins or an hour to what ever the programed session start
time was ? Just leave every thing else the same . So if the Session start time
was 6:30 AM and you added 30 minutes , it would just start it calculation a
half hour after the Session start time . You can kind of do this by changing
the start and end times on the chart like : 07:00:00 to what ever ending time, but the settings don't hold if you close and then reopen the same group . Quite annoying to have to do that every day . thx .
NinjaTrader_Josh
11-12-2009, 01:44 PM
T2020,
Feel free to make any changes you want. This indicator was developed in my free time, but unfortunately I will not be able to maintain it at this point in time.
T2020
11-12-2009, 01:53 PM
T2020,
Feel free to make any changes you want. This indicator was developed in my free time, but unfortunately I will not be able to maintain it at this point in time.
Thanks for you reply . I was looking for a clue as to what line of code I could
add the extra time to . I'm sure your busy what with NT 7 and all . Perhaps
someone else will find some interest in my approach . thanks again .
NinjaTrader_Josh
11-12-2009, 01:56 PM
You can try looking around and adding a .AddMinutes() to the DateTime where it was set, before it is used. Should be somewhere in the beginning of the code.
superarrow
11-13-2009, 12:40 AM
I guess I don't quite follow. Perhaps a screenshot will clarify.
Hi Josh,
Sorry my mistake. Have two platforms with differing time zones. Thanks for your response.
SA
higler
12-03-2009, 09:32 PM
This is long - I apologize. I thought that I would post a modified VWAP (hVWAP) where I have tried to address the following:
1. VWAP start/end times were not retained when a workspace is closed and reopened. This may be due to the nature of TimeSpans (perhaps they don't implement the necessary interface). I've modified the indicator's start/end times properties code so they are saved as strings (which are retained) and then convert to TimeSpans. This includes some bounds checking and still uses a 24 hour clock (hh:mm:ss).
2. VWAP would not cross midnight (start time could not be greater than end time)
I modified the code so that this can now happen. Actually, I've tried to modify the code so that it calculates based soely on the indicator's start/end times (ignores the chart's session Begin/End times). Different chart properties session begin/end times can be selected for the charts and hVWAP should calculate and plot through them (unless, of course, a session ends and acceptable times and/or data is not available, in which case hVWAP plots again when appropriate data is available). If you are not using 24 hour charts (chart Begin/End Time properties the same) then be carfeul that your Chart Properties Begin/End times do not create a "data gap". If not using a 24 hour chart then your Chart Properties Begin/End times gap should not be within the indicator's start/end time (otherwise, the indicator might calculate right through the gap but miss calculating on data that you wanted included).
3. VWAP was inconsistant with with some start times.
IMPORTANT!!! From the NT documentation: "NT stamps a bar with the closing time. A minute bar with a time of 9:31:00 AM has data from 9:30:00 AM to 9:30:59 AM."
This means if you have a 1 minute based chart and you want to start calculating at 9:30 AM, you actually want to start calculating at the bar which get timestamped 9:31. VWAP gets this correct when VWAP starts at a session begin but at other times can start a bar earlier. hVWAP should start on the correct bar. Also, there are some things that affect both VWAP and hVWAP. If you have a 5 minute bar chart and select an indicator start time that occurs in the middle of a bar (example: 5 minute bars and the indicator's start time is set so that it would start 3 minutes into the bar) then when doing live real time charting the VWAP and hVWAP calculations will actually start calculating at the beginning of that bar and not 3 mintes into it. This may be related to minute based bars being built from minute data and as soon as the bar begins it gets timestamped(?) If you want a minutes based bar to start calculating at a particlar time then ensure the beginning of the bar will align with the hVWAP start time. This is not so on tick based bars. hVWAP is modified so that with tick bars it will start on a tick intra bar on live tick data charts when the indicator start time conditions are met.
4. hVWAP has a modification to the StdDeviationProb method.
This is for the following reasons. In original VWAP, the Bars.BarsSinceSession call results in part of the Std Dev calculation starting from the beginning of the session even if your start time for the indicator is hours later. For example, plot original VWAP on a 1 minute bar chart with the chart properties session begin time at 12:00 AM and the VWAP indicator's start time at 10:00 AM, for example, and select Calc Mode as VWAP. Then, experiment with changing the chart's properties Session Begin time. As you move the chart's session Begin time closer to the indicator start time then you get different SD values. hVWAP bases this calculation on the hVWAP indicator start time since it ignores session start times. Calc Mode "AvgVWAP" was not affected since it doesn't use the Bars.BarsSinceSession in its calculation.
Following are notes from the hVWAP change log.
Moved BandType enum into hVWAP Indicator Class definition under Constants to prevent hVWAP conflict with original VWAP (they can coexist).
Saved Start and End Times as strings (instead of TimeSpans) and convert (with some bounds checking) to TimeSpans as necessary so that Start and End Times are retained when a workspace is closed. TimeSpan settings don't seem to be retained when a workspace is closed and reopened. Strings are retained.
Modified so that indicator can start on one day and end on following day. This is assumed to be the desired behavior when the indicator Start Time is greater than or equal to the End Time. The indicator will not span greater than 24 hours but it is flexible in using various start and end times, overlapping parts of 2 consecutive days, etc.
Most of the the original VWAP calculations were maintained but some changes have been made in determining and comparing the necessary DateTimes to correct some issues and implement hVWAP indicator Start Time being greater than End Time. StdDeviationProb method was modified so that it calculates based from the first bar from the indicator start time (uses a variable barCount) when Std Dev Calc Mode "VWAP" is selected. Does not use the original VWAP's Bars.BarsSinceSession (the number of bars since the session start). Implemented a variable firstCalcTick to so that the indicator would work properly on real time tick bars.
The indicator start and end times use a 24 hour clock. To span the full 24 hours make sure that the indicator start/end times are the same.
I have attached a JPEG of hVWAP crossing the midnight boundary.
There may still be a few bugs in this.
This is for NT 6.5. Might need to be rewritten for NT 7 but see the following.
Actually, so far this seems to be working fine for me under NT7. The changes that I made seem to be be working OK and inadvertently made it NT7 compatible (probably because I eliminated using session begin/end times and went only with the indicators start/end times). Maybe this is why because I haven't reviewed the code changes in detail. Anyway, hVWAP imported and compiled OK under NT7 and it hasn't "blown up on me yet.
T2020
12-03-2009, 10:29 PM
Thank you higler (http://www.ninjatrader-support2.com/vb/member.php?u=1479) ! That's exactly what the indicator needed . Great work . :)
T2020
12-06-2009, 10:35 PM
This is long - I apologize. I thought that I would post a modified VWAP (hVWAP) where I have tried to address the following:
There may still be a few bugs in this.
This is for NT 6.5. Will need to be rewritten for NT 7.
I just noticed that the indicator works fine Monday thru Friday with start and
end times ,but starts from scratch over the weekend . When the market opens on Sunday evening ,if you have it plotted say 3 times on the same
chart ,they all start at the session open . Was this the way you intended ?
thx .
higler
12-07-2009, 08:32 AM
T2020
I'm not sure. This may be a bug. Can you tell me your chart set up with the indicator start/end times, chart properties begin/end times, etc. and I will try and reproduce it. I'll take a look at it and respond.
T2020
12-07-2009, 09:51 AM
T2020
I'm not sure. This may be a bug. Can you tell me your chart set up with the indicator start/end times, chart properties begin/end times, etc. and I will try and reproduce it. I'll take a look at it and respond.
Sure no problem .hth's .
I have my chart session set to 6:30 to 6:30 AM . PST . On this chart I have
3 hVWAP . One set to 4 am start and end , One to 5 am start to end and the last set to 6:29 start and end the same . As you can see all 3 plot the
same value starting at the Sunday open .
higler
12-07-2009, 12:17 PM
This is what I'm pretty sure is happening. There has been no data from market close Friday afternoon until market open on Sunday afternoon. The various hVWAP's calculated that the various start times for the day (Sunday) were to be 4 am, 5am, and 6:29 am with the end times 24 hours later. However, on Sunday there is no data for the indicator to work with between the "calculated Start Times" and when the data starts flowing at the market open (Sunday 3 pm PST?). During this time all the hVWAPs are monitoring for data that falls between the calculated start times and the end times. The first data that meets this criteria on Sunday is when the market opens on Sunday afternoon and this falls within the calculated start/end criteria for all three hVWAPs, so they all start calculating at the same time, with the same data, and produce the same results. Everything should reset properly on Monday morning. This situation might arise on some holidays also (I'm not sure) or whenever there is a break in the data before the start time and that starts up again after the calculated start time.
Basically, the indicator (as currently programmed) starts calculating at either the start time (if there is bar data) or the first bar that falls within the start/end criteria, whichever comes first.
Would you like to be able use different start criteria for Sunday?
I'm open to suggestions and improvements. Thanks.
T2020
12-07-2009, 04:22 PM
This is what I'm pretty sure is happening. There has been no data from market close Friday afternoon until market open on Sunday afternoon. The various hVWAP's calculated that the various start times for the day (Sunday) were to be 4 am, 5am, and 6:29 am with the end times 24 hours later. However, on Sunday there is no data for the indicator to work with between the "calculated Start Times" and when the data starts flowing at the market open (Sunday 3 pm PST?). During this time all the hVWAPs are monitoring for data that falls between the calculated start times and the end times. The first data that meets this criteria on Sunday is when the market opens on Sunday afternoon and this falls within the calculated start/end criteria for all three hVWAPs, so they all start calculating at the same time, with the same data, and produce the same results. Everything should reset properly on Monday morning. This situation might arise on some holidays also (I'm not sure) or whenever there is a break in the data before the start time and that starts up again after the calculated start time.
Basically, the indicator (as currently programmed) starts calculating at either the start time (if there is bar data) or the first bar that falls within the start/end criteria, whichever comes first.
Would you like to be able use different start criteria for Sunday?
I'm open to suggestions and improvements. Thanks.
I think your right ,but it's not a big deal . I don't know if there's a way to
treat the last bar on Friday thru the First bar on Sunday like a Gap and just
keep on continuous calculating ? Just a thought ,but I'm making good use
of the your improvements and thanks again for working on it .
sam777
12-12-2009, 03:09 PM
Today is my first day and first post. I downloaded VWAP from the NinjaScript File Sharing Indicators (is it the latest version?)
Then clicked on the link in there and took me to this thread. As I was reading thru' all the posts from the beginning, I downloaded some zip files (versions of VWAP) and in doing so found I was totally confused and worse it overwrote the version VWAP that I first downloaded to begin with in Ninjatrader.
How do I delete some of the versions imported in to Ninjatrader? Now I unable to download the version I started with?
Thx, Sam
T2020
12-12-2009, 05:24 PM
Today is my first day and first post. I downloaded VWAP from the NinjaScript File Sharing Indicators (is it the latest version?)
Then clicked on the link in there and took me to this thread. As I was reading thru' all the posts from the beginning, I downloaded some zip files (versions of VWAP) and in doing so found I was totally confused and worse it overwrote the version VWAP that I first downloaded to begin with in Ninjatrader.
How do I delete some of the versions imported in to Ninjatrader? Now I unable to download the version I started with?
Thx, Sam
The version you want is the hVWAP at post 194 . Download it and install .
No need to uninstall the others . However ,if that's what you want ,then
just download the 1st version and reinstall it in Ninja over whatever version
you have and you will have reverted to the 1st one you installed . Note :
the hVWAP is the same indicator just without some the bugs . ;)
T2020
12-12-2009, 05:33 PM
How do I delete some of the versions imported in to Ninjatrader? Now I unable to download the version I started with?
Thx, Sam
This type of installed indicator can be deleted if you go to the Control panel
> Tools > edit indicator > find the one/one's you don't want and delete it
there . Note :A installed Ninja script indicator needs to be deleted thru the
Ninja script deletion path .
sam777
12-13-2009, 10:08 AM
Thanks for directing to get the latest version hvwap. Reading thru' the post #194 and thereafter, just to confirm. Say ES instrument:
M-F: 4:30 pm est Start - 4:15 pm est End - Within the indicator (Start and End times) overrides Chart Session Start/End time?
M-F: - I have set the start/end times the same - in the indicator itself and Chart Session Properties. Want to see over the entire ES open/close - please correct me if my understanding is wrong!
Sunday - ES opens at 6 pm est instead of normal open at 4:30 pm est. What do I need to do to have it start on Sunday at 6 pm? Do I change in the indicator hvwap the start time on Sunday and then reset on Monday to start at 4:30 pm est?
Do the hVWAP plots of previous sessions stay intact and are valid?
If I change the time frames (5/10/30 minute charts - intraday), do the hwap plots (still valid) recalculate and are accurate or everything is thrown off? Say it starts at 4:30 pm est with a 5 min. chart and say at 10 pm, I change the chart to 30 minutes without changing the start/end times in the hwap indicator - what is exactly happening and what should I expect to see with the hwap plot as the time frame is changed?
If hwap plots are thrown off as in the question above, then the alternative may be to open the 5 min and 30 min. charts in 2 separate windows with the same start/end times in the hwap indicator itself, so the hwap plots are accurate?
Is the hwap plot a price histogram ie tpo count or a volume histogram? Looks like it is providing the boundaries of standard deviations 1,2,3 with VWAP mimicking the POC!
The hwap's it dispalys for days back in time are they valid? The reason for this question is as I am confused reading the posts ie only accurate in real time and with start/end times to match with the instrument start/end times.
The historical hwaps plots displayed are invalid or a close approximation to being considered valid?
If close to being valid, then it can then be used to see the VPOC's - Virgin Point of Control - let me know!
To see hwap plots (ie overnite and day sessions), can I split the plot or have to plot 2 hwaps with different start/end times?
I have just started looking at available indicators at the support forum outside the ones downloaded with Ninjatrader software. I have noticed a Value Area indicator and I am wondering if that is the Price Histogram with he 70% distribution.
Thanks
T2020
12-13-2009, 12:28 PM
Thanks for directing to get the latest version hvwap. Reading thru' the post #194 and thereafter, just to confirm. Say ES instrument:
M-F: 4:30 pm est Start - 4:15 pm est End - Within the indicator (Start and End times) overrides Chart Session Start/End time?
That's correct .
M-F: - I have set the start/end times the same - in the indicator itself and Chart Session Properties. Want to see over the entire ES open/close - please correct me if my understanding is wrong!
Setting the indicator start/end times over rides any chart properties.
If you set it for 24 hrs ,that's what it does .
Sunday - ES opens at 6 pm est instead of normal open at 4:30 pm est. What do I need to do to have it start on Sunday at 6 pm? Do I change in the indicator hvwap the start time on Sunday and then reset on Monday to start at 4:30 pm est?
The way the indicator is now ,it starts all over every Sunday -
period ,but your previous setting stay the same and will start and
stop at those settings thru out the week .
Do the hVWAP plots of previous sessions stay intact and are valid?
Far as I can see they do .
If I change the time frames (5/10/30 minute charts - intraday), do the hwap plots (still valid) recalculate and are accurate or everything is thrown off? Say it starts at 4:30 pm est with a 5 min. chart and say at 10 pm, I change the chart to 30 minutes without changing the start/end times in the hwap indicator - what is exactly happening and what should I expect to see with the hwap plot as the time frame is changed?
Remember the indicator is based on the "close" ,so going from a 5
to 30 min chart will change the value somewhat .
If hwap plots are thrown off as in the question above, then the alternative may be to open the 5 min and 30 min. charts in 2 separate windows with the same start/end times in the hwap indicator itself, so the hwap plots are accurate?
I always use multiple time frame on different charts personally .
Is the hwap plot a price histogram ie tpo count or a volume histogram? Looks like it is providing the boundaries of standard deviations 1,2,3 with VWAP mimicking the POC!
Thanks
The rest of your questions ,I couldn't answer for sure..
Hth's .
sam777
12-13-2009, 03:12 PM
Thanks HTH.
In the hwap indicator, Calculate on bar close set "False" as default. I guess due the Ninjatrader Timestamp issue, hence set at False. So if start time set at 4:30 pm for es, hwap starts at 4:30 pm ie ticks! Is that correct?
I saw Price Markers set as True. However, I am not getting the numerical values for the VWAP, 1,2,3 std. devs. to display. How to make it display?
Also, what is that Accuracy Warning - True. Looks like to resolve that warning displayed in previous VWAP indicator. Correct?
Will look in to that Value Area indicator so that I can see if it resembles Market Profile. There was a very good post (don't remember the post number) - must be in the beginning of the thread - where someone compared the vwap to one from Ensign showing the pictures.
Will see how it comes together ie hwap with value area.
Sam
higler
12-13-2009, 06:19 PM
sam777
I don't have many opportunities to contribute right now, since I have joined the ranks of the unemployed and am putting most of my energies into trying to find a job. As a result, T2020 is probably much more familiar with how well or not the indicator is behaving, but I will just try and respond to a couple of your questions.
Setting Calculate on Bar Close to false means that the indicator should be calculating and updating on each tick. Setting Calculate on Bar Close to true means that the indicator will calculate and update only at the end of each bar. This shouldn't have anything to do with the time stamping of bars, only with how often the indicator recalculates. Updating on each tick is more computer resource intensive since it accounts for every tick but it should be more accurate.
The accuracy warning is just letting you know that VWAP or hVWAP are most accurate when it is loaded before the market start. That way, they can calculate based upon every tick. If you load the indicator after market start then the indicators can only calculate on the close values on previous bars. If you load the indicator before market start then the acurracy warning should go away sometime after the market starts.
I do not know why the price markers are not showing up for you. I have never had a problem with this. Maybe T2020 or someone else has some thoughts on this. Maybe you could post a picture of what your chart looks like?
mea109
12-16-2009, 08:49 AM
Hello to all Sorry to bother you
just in case someone would know and he scrambled for the skew ninjatrader?
I thank you and wish you good trades
NinjaTrader_Josh
12-16-2009, 08:51 AM
Hi mea109,
I am not sure what you mean. Can you please clarify what you mean by "he scrambled for the skew NinjaTrader"? Thank you.
mea109
12-16-2009, 09:00 AM
Josh hello sorry for my bad English
in fact I am looking indicator skew
is this clearer?
NinjaTrader_Josh
12-16-2009, 09:09 AM
mea109,
Best place to look is the file sharing section for indicators on our forums. If it is shared, you should be able to find it in there.
mea109
12-16-2009, 09:23 AM
thanks Josh
just for info
skew for me it's
Skew = (VWAP-PVP) / SD
cclsys
12-20-2009, 12:54 PM
Higler. THANKS, and good luck with job search. I am sure you'll do well.
Suggestion to you/anyone: is there any way to be able to call the start and end times in another indicator? For example, I use dvaluearea a lot and would like to start adding in some bells and whistles involving relations of dynamic PVP to VWAP, but to do this either I have to stay with 24 hr VWAP or I am comparing apples and oranges if the 2 don't have same start and end times.
higler
12-20-2009, 10:09 PM
cclsys
Thanks. I'm not quite sure what you might want to do, but here are some thoughts. I took a quick look at dvaluearea and it looks like it begins/ends at the Chart Properties Session Begin/End times. If you want dvaluearea and VWAP (or hVWAP) to start and end at the same times then you might try setting the VWAP indicator start/end times to coincide with the Chart Properties Session Begin/End times. This should "sync up" the two indicators as far as starting and ending at the same time. I briefly tried this with dvaluearea and hVWAP and it appeared to work. Also, if necessary, we might be able to modify the dvaluearea code so that start and end times can be specified. There are a number of things that can be tried. Can you provide some more details/examples of what you may want to do, including possible start/end times for the indicators?
Gains
12-21-2009, 11:01 AM
Josh,
Any chance this will be updated to work with the new NT7 session structure?
Hopeful,
Gains
cclsys
12-22-2009, 01:59 PM
Higler, sorry for slow reply. Was wrestling (literally) with rural plumbing issues yesterday!
OK. First thing: if I reference your VWAP in dValue, there are no inputs for the time.
So actually I tried referencing dValue in hVWAP and had my first ever total system crash. Nothing in the log. Couldn't identify anything in the trace but maybe that's me. Had to delete everything and start over. I mean delete hvwap and dvalue from the indicators folder, reboot, and then edit out the lines I had put in and then put it all back together. All is now fine.
So it appears that I can't call dValue easily in another indicator, either because I am doing something dumb, or because of some problem with dvalue. I will never find out because I'm not going through that again!
Generally though, I have noticed that the time business is an issue with the VWAP. This is both positive and negative and in fact I have more ideas now, though irritatingly for myself and no doubt others, lack the skills to implement them.
For example: I would REALLY like to have an indicator that show me the VWAP from the day-session close yesterday, and day before, and a 2-day VWAP and a one-week VWAP. What this would boil down to is having a VWAP that has a start and end time that can be based on hours and minutes as is currently the case, but also how many days back.
Then there is yet ANOTHER issue: if I were to change the start time in the Properties Menu to line up all the times, then also all the volume data is skewed. Unless you want only day-session data that is in which case it works fine. But I would prefer not to be confined to that even though perhaps that is the simplest thing. dValue, for example, has a start and end time for the day-session but that means everything outside is plotted in red as the non-main-session histogram, i.e. it still reads all the stuff.
I hope I am making sense.
a) I cannot call hvwap in another indicator and specify start-end-times
b) I have had serious problems calling dValue inside hVWAP but there are no end of possible reasons why that might yield problems. If you are interested, since you are clearly a far better programmer, you might want to try to call dValue (latest 3.2 version with dynamic PVP) in your hvwap. What I was doing, by the way, was trying to calculate the skew using the formula:
skew = (VWAP-PVP)/SD; Since I got no error msgs I have no idea why it crashed NT. Completely. Every time it reopened it just said: 'sorry no go, closing down now' and did.
Now I have managed to make a skew indicator within dValue but using a simpler formula without referencing SD. It is fine.
But what I would REALLY like is what I mentioned above in terms of being able to put up various different VWAPS. Frankly, it would be best (for me) to have previous day/week vwaps plotted as horizontal lines with text like with a pivot indicator saying from which date it is plotted. Some people using Ensign have both previous VWAPS and previous SD1's, 2's etc. plotted as lines on current trading chart. I would be happy with previous VWAPs (and previous PVP's). For me that would make an ideal pivot matrix which is why I am interested in this. I am finding that previous PVP's are very helpful to keep track off. And I suspect that having previous VWAPs and/or different period vwaps (like 1 day, 2 day, 1 week) etc. would be similarly helpful.
In fact, now that I write this out I suspect that what I personally would like best is previous day/week POC at day-session closes, and ongoing multi-day vwaps, i.e. 2 day Vwap, one week vwap, one month vwap that are updated each bar (no doubt calc on bar close = true being advisable!) They already can do this in Ensign but we don't have it yet in NT.
Sorry for length of this post. Old English Schoolboy syndrome. They used to force us to write everything out in about 10 times as many words as were necessary.
I will try to make a picture small enough that NT forum can accept so you can see this tentative indicator along with the dynamic PVP's. Just because it might be of interest. But then also perhaps you can better understand why I would like to see longer-term vwaps. Often even the 24hr and day-session vwaps are 'in conflict' viz. any skew. Having the LT ones there would be helpful. Yes, I can just look at other charts, but I prefer to have most important stuff (within reason) on main chart to reduce distractions. The pic attached (if I can upload it) has too much stuff (2 sets of SD bands for example) but I am tracking different vwaps etc. to compare them.
In this picture you can see the last dynamic PVP flip turned the indicator skew negative (central plot changed from gold/bullish to blue/bearish. But in the middle there were several instances of the 24 hr vwap (darker magenta) being bullish skew but day-session being bearish. This is why I would like to see previous day POC's and vwaps up there so I can put current dynamic in larger context more easily.
NinjaTrader_Josh
12-22-2009, 02:17 PM
Gains,
Will consider, but at this point in time I have too much on my plate.
higler
12-22-2009, 02:45 PM
cclsys
I'll take a look at it and respond. When I modified the original VWAP it was to get it to save the start/end times when a workspace was closed and to allow it to span midnight and some other modifications. I didn't even think about it being called in another indicator. I'll take a look.
cclsys
12-22-2009, 03:16 PM
Higler: obviously this is all voluntary/inspired work; certainly no 'demand' on my end.
Josh, thanks. I didn't expect you guys to be into this sort of thing now with NT7 in the pipeline. But I do think multi-day vwaps etc. (along with SD's) would be a good thing to have, not to mention the POC's, and other platforms do have them so it is definitely worth considering on your end to include in next release.
NinjaTrader_Josh
12-22-2009, 03:42 PM
cclsys,
This was provided as a 3rd party side project of my own. As mentioned in this thread, unfortunately I just don't have much time to maintain/improve/etc this code any more at this point in time.
higler
12-22-2009, 06:22 PM
cclsys
I am not familiar with PVP.
I took a quick look at things and can see any number of reasons why the code might "blow up" if trying to call one of these indicators from another. Anyway, as far as VWAP or hVWAP goes, it might be easiest to change the indicator Start Time and End Time to DateTime structures. This would permit you to specify the starting date and time and also the ending date and time and it would calculate based upon all the bars between those two dates/times. For your purposes, you might even prefer no ending date and time have have them just all calculating continuously from a specified date and time. However, it would be up to you to determine how many days or weeks might be encompassed with your settings. One of the problems with just telling it the number of days or weeks back is that it can encompass weekends, holidays, shortened trading days, contract rollover dates, etc. that you may or may not want in the calculations. Having you specify the starting and ending dates/times forces you to determine if you actually want to use those periods and data. However, it also means that you might need to update your settings every day. Anyway, I think that I can modify it so that you can specify starting dates/times and ending dates times ior just starting dates and time if that would help.
I don't currently have the time to add all the other features and it would probably be easier to rewrite VWAP from scratch to incorporate everything.
higler
12-23-2009, 12:57 PM
cclsys
I have done a quick hack to hVWAP which I hope will help you out somewhat. It is hVWAPccl (attached). The indicator start time and end time are DateTime structures which means they take a date and time such as 11/24/2009 7:00 AM. This really is a quick hack of hVWAP and therefore may do some unusual things (for instance I haven't done any bounds checking and I don't know what happens if the end DateTime is before the start DateTime, etc). The coding is not "elegant" because it is a quick hack. I have tried it briefly and it seems to do what I intended it to do which is:
The indicator calculates VWAP between the specified start and end DateTimes ONLY. It does not repeat again at some future DateTime. After the indicator gets to the end DateTime it will continue to plot the final values for that time period on the chart. So, if you have a previous week, or two days, etc that you wanted to compare against currently, you can set this indicator up, use the start and end times for the period and it will continue to plot the final values on the chart so you can reference against what those values were. You should be able to instantiate multiple instance in case you want to be viewing a previous week, days, etc. It is the users responsiblity to make sure they select the appropriate DateTime periods that they are interested in in the Start/End DateTime settings. You may end up with lots of lines on your chart if using multiple instances but you should be able to turn off the ones you don't want. Undoubtedly you'll want to use different colors, line widths, etc, to try and keep track of which is which. I haven't had the time to just have it draw a labeled line.
I have attached an image showing the end of the indicator calculation period and the final VWAP values continuing to plot to the right that could be used for future reference. Hope this provides some help. Also, this indicator is not suitable for calling from another indicator, method, etc. as it would need modifications before being able to pass in the necessary parameters and ensure that it would always return an acceptable value(s).
Also, when the indicator is applied for previous reference calculations then I recommend that you set the indicator Calculate on Bar Close to true to reduce system load.
Actually, if this indicator modification is helpful and I can ever get an extended period of time then I should be able to simplify this into a "callable" method which could be called from other indicators or methods to reference the various VWAP return values.
cclsys
12-23-2009, 09:50 PM
Josh, understand. By 'you', though, I really meant 'Ninja Trader Development Team' or 'NT programming dept'.
After doing a couple of Google searches, I have realised that some of these start-end issues with the VWAP have been dealt with in numerous ways. Ensign really does have a good package on this which allows you to show previous vwaps and SD's as lines on current chart, also different time-scale vwaps such as 2-day, one week etc. So this seems to be something that those who use vwap and market-profile type stuff find very helpful.
cclsys
12-23-2009, 09:57 PM
Higler: what can I say? Haven't tried it yet (your post did not come up in my messages yet but Josh's earlier one I just found and clicked on to respond), but thanks very much. I look forward to playing around with the start-end times in terms of making static pivots for today's session. I hope at some point your or somebody can make a callable vwap so that it can be synchronised with other indicators. Right now, the only way I can use vwap in skew formulas with dValue or any other Volume Profile type indy is starting at midnight ending at midnight which is somewhat arbitrary to say the least. And the values do change considerably compared to starting at session-end and going on for 24 hours, or starting at session begin for 24 hours, or only during the day-session times etc. etc.
I had always somewhat naively thought that the vwap was the vwap was the vwap and it was a universal number the same for everyone which is mainly why I turned to it as my main 'go-to' MA-type indy on a chart (apart from experimenting with Ichi donchians earlier this year for trend-following purposes). But now I see that it is not so simple. I think this confusion started because in Tradestation which I used to use there is a default vwap that shows up in the DOM. I assume that this is the typical vwap used by most instituations and traders and tried to find out via google what calculation they use but didn't get a definitive answer yet. If I do, I will post it here just for future reference. Of course, maybe their vwap is not the one followed by most institutional traders. Maybe there is no such vwap. But if there is, it would be good to know what it is.
In any case, thank you very much. I hope others find this useful too (assuming it works as I have little doubt that it will!).
cclsys
12-23-2009, 10:10 PM
This page has the code and/or description of many different versions. Interestingly, in terms of this thread, nearly all of them deal with the starting date issue. Ninja's is pretty much the only one that doesn't. Indeed, one favored approach - apparently from the Midas chap - is to start it from a key reversal point.
In any case, clearly this is a key issue with this indicator so I/we have not been all barking up irrelevant trees in bringing it up.
http://www.traders.com/Documentation/FEEDbk_docs/2008/09/TradersTips/TradersTips.html
cclsys
12-23-2009, 10:23 PM
well, I tried loading it before knocking off this evening. Index out of bounds of the array error. I put up Dec 21 - Dec 23 as the dates, no go, so changed to Dec 21 - Dec 22nd (yesterday). Same error. Have one week's data loaded on a 2-minute chart.
Also, there are no inputs available for start time end time etc. so I guess it uses whatever is in the code; so changing that manually is okay but it means you can only run it on one instrument at a time or only with instruments with the same start times if that is how you want to start it. Ideally there would be start & end Year, Month, Day, Time, Hour, Second. Why second? Because I think for a one-day vwap starting at 8.20, say, I suspect it's best to have it start at 8.30.00 and the end time to be 8.20.59;
Higler - don't worry about this. Enjoy the holidays!
cclsys
12-24-2009, 12:49 AM
On page 1 or 2 of this thread is an indicator called VWAPMulti which can plot based on a start date and time. The bands seem to be all wrong, but you can get ongoing plots of VWAPs from 1,2,5 etc. days back. Only problem is that you have to reset them each day. Ideally this could be re-tooled to
a) get rid of the bands or get them right
b) have a daylookback feature, i.e. 1 day lookback, 5 days etc
c) sessionstarttime and end time or for 24 hr = 00,00
d) make it so you can change the plots, right now you can change the color but not the type of dashstyle for some reason.
I wouldn't know how to introduce a day look back but maybe somebody else does.
In any case, this is not the same as notion discussed with Higler above in terms of having yesterday's vwap at session end plot as horizontal line on today's chart. Still, the multi version is helpful despite need to keep updating start date each morning. Hardly the end of the world having to do that. But not workable for historical testing.
Pic from page 1 or 2:
http://www.ninjatrader-support2.com/vb/attachment.php?attachmentid=1906&d=1204830137
My pic using multi from Monday (plum color line) and 1 week ago (yellow line).
Here we see the weekly equilibrium up above 1100 with the current std deviation from 24 hour vwap which resets at midnight right at the yellow weekly VWAP line. There is a positive skew comparing weekly vwap to current POC. Should get up there soon.
Scrunched this 5 min chart together to show the lines. Used poor quality to be able to post under 100k.
Also can see how dynamic POC (white dash line) ending today is right in line with plum vwap starting Monday.
So thanks to Rollins of post #9 at http://www.ninjatrader-support2.com/vb/showpost.php?p=23218&postcount=9 for making this.
higler
12-24-2009, 12:33 PM
cclsys
Sorry its not working for you. Maybe something good will turn up for the holidays.
T2020
01-11-2010, 08:56 AM
I went through and changed ever instance of where I saw Dot Monday to
Dot Sunday and now with the start time set to the open on Sunday ,it plots
exactly the same as the weekly Vwap on Think or Swim . Just like to be on
the same page . thx .
paulg
01-12-2010, 11:18 AM
I went through and changed ever instance of where I saw Dot Monday to Dot Sunday and now with the start time set to the open on Sunday ,it plots exactly the same as the weekly Vwap on Think or Swim . Just like to be on the same page . thx .
T2020; could you please a snapshot about your new settings ?
Kind regards,
Paul
T2020
01-12-2010, 02:49 PM
T2020; could you please a snapshot about your new settings ?
Kind regards,
Paul
If you look here in the code , you will see " DayOfWeek.Sunday " in 3 places . It
used to be "Dot Monday " . That's all I changed . Hope that helps .
if (startTime.Date != Time[0].Date && Time[0].DayOfWeek == DayOfWeek.Sunday)
startTime = new DateTime(Time[0].Year, Time[0].Month, Time[0].Day, openHour, openMinute, 0);
if (Bars.SessionBreak && Time[0].DayOfWeek == DayOfWeek.Sunday)
{
VWAPLine.Set(0);
estvwap = false;
if (bandType == BandTypeW.AvgVWAP) CalculateOnBarClose = false;
//timecheck = 1;
vwapsum = 0;
vwapavg = 0;
volwap = 0;
volumearray.Clear();
pricearray.Clear();
vwaparray.Clear();
priceRangeArray.Clear();
priceRangeVolArray.Clear();
}
// Calculate current volume
//if(FirstTickOfBar)
if (FirstTickOfBar && Bars.SessionBreak && Time[0].DayOfWeek == DayOfWeek.Sunday)
paulg
01-13-2010, 11:36 AM
If you look here in the code , you will see " DayOfWeek.Sunday " in 3 places . It
used to be "Dot Monday " . That's all I changed . Hope that helps .
Thank you T2020,
Did you upload the new version compiled under thee sharing section?
T2020
01-13-2010, 12:33 PM
Thank you T2020,
Did you upload the new version compiled under thee sharing section?
Well , since I'm not the author of this indicator ,I'm not sure I'd be allowed
to change it in the indicator section or that it's even my place to try . I
posted the relevant code so anyone could edit the indicator themselves ,if
they agreed with the changes . Really ,you only have to change one word
in 3 different places and your done . If you have the original indicator installed , then open it at > Tools > edit Ninjascript : and make the changes .
Done deal . good luck .
cmrodrig
01-20-2010, 04:21 PM
Well , since I'm not the author of this indicator ,I'm not sure I'd be allowed
to change it in the indicator section or that it's even my place to try . I
posted the relevant code so anyone could edit the indicator themselves ,if
they agreed with the changes . Really ,you only have to change one word
in 3 different places and your done . If you have the original indicator installed , then open it at > Tools > edit Ninjascript : and make the changes .
Done deal . good luck .
T2020,
Like Paul, I also can't figure out what is the version of VWAP indicator you mention in your post.
Sure, I'll be able to make the changes you recommend, as soon as I can download the indicator.
Could you kindly indicate where can we download it ?
Kind regards,
Candido
cclsys
01-20-2010, 04:28 PM
Me too! Which indicator did you change precisely. I can't find the code you mention in hvwap.
T2020
01-20-2010, 05:33 PM
Me too! Which indicator did you change precisely. I can't find the code you mention in hvwap.
Here's the indicator with the changes made . It's the exact same name so
it will write over the existing one if you happen to have it on your computer.
The only change was the start date . Changed it from Monday start time to
Sunday . Hope you both find it useful . ....
cmrodrig
01-20-2010, 05:57 PM
Thanks for the indicator.
Now I can plot the weekly VWAP.
However what I can notice is that price is too far away from VWAP as week goes on.
Do you use it for your trading decisions ?
Kind regards,
T2020
01-20-2010, 07:11 PM
Thanks for the indicator.
Now I can plot the weekly VWAP.
However what I can notice is that price is too far away from VWAP as week goes on.
Do you use it for your trading decisions ?
Kind regards,
I keep an eye on it . Like pivots ,it all depends on what price is doing when
it gets close and what's to the left .....
cclsys
01-20-2010, 08:15 PM
Thanks T2.
cclsys
02-15-2010, 10:22 AM
Using hvwap, someone suggested I changed in Properties the start and end times from being in "Settings" to "Properties" to make hvwap callable in other indicators. This worked. But now I am getting both a log error and an occasional pop-up serializing error.
Log:
Failed to restore indicator 'NinjaTrader.Indicator.hVWAP'. Most likely (a) the implementation changed or (b) one or more properties have been renamed or removed or (c) the custom assembly which implements this indicator no longer is there.
popup (also in log):
Indicator 'NinjaTrader.Indicator.hVWAP' could not be serialized. Please refer help for more information on serializing indicators.
Any clues on what do do here?
I attach test version of hvwap to play with so that original does not need to be touched.
cclsys
02-15-2010, 12:21 PM
I think the problem has to do with templates. Not 100% sure but suspect that's it. I have another version with identical code called from within a skew indy and it is never having errors.
Later: nope. Erased hvwap from my indicator directory and error is still there and as far as I can tell it's not being referenced in any other codes. Weird.
Ricam
02-15-2010, 12:28 PM
If it is a template problem, maybe setting the chart template to 24/7 would help. Just a guess, easy enough to try. Good luck.
Z.
NinjaTrader_Bertrand
02-15-2010, 12:54 PM
cclsys, for proper serialization routines you want to check into this sample here - http://www.ninjatrader-support2.com/vb/showthread.php?t=4977
cclsys
02-15-2010, 01:20 PM
bertrand, thanks. In the accompanying code I was using something like that. but it's for a color serialisation, not string.
It's referenced in a lot of templates and workspaces, though not any I am loading. Could that be it?
Also: how can a file show up in a search as being in a directory (10 times!) when I deleted it from the directory. Never noticed that before. I moved hvwap.cs from Indicators directory to somewhere else. Then did a search from hVWAP in all files and folders in the NT directory. It came up where I stored it, but also 10 times in the Indicator directory.
Now that I think on this further: there IS no 'Indicator' directory, only one in the Custom/Bins/Indicator. Anyway, I have deleted all those files and still the error remains.
cclsys
02-15-2010, 01:47 PM
Ricam. Thanks for suggestion. But my problem is that the templates being loaded have no indicators in them referencing hvwap and I re-saved the templates being loaded with current indies and still the error comes up when I open the workspace.
NinjaTrader_Bertrand
02-15-2010, 02:35 PM
cclsys, correct, indicators are saved in the MyDoc > NT6.5 > bin > Custom > Indicator directory.
The issue might be you have another workspace loaded in the background, but do not notice it - try cycling through open ones via Shift and F3 to check.
ct1942
02-15-2010, 03:22 PM
Is there a way to add multiple indicators at one time or do you have to import them one at a time?
NinjaTrader_Bertrand
02-15-2010, 04:07 PM
Only if they are all contained in one zip file, otherwise you would need to import each zip file on its own.
PatientTrader
03-05-2010, 06:40 PM
Josh or anyone,
Can you please tell me what is the latest vwap indicator ? I tried vwap long time ago, but it was system resource intensive so dropped it.
Trying to find out, which is the latest version and how system instensive it is.
Thanks
PatientTrader
higler
03-06-2010, 09:24 AM
PatientTrader
I haven't kept real close track of VWAP recently since I've been working on other things. However, VWAP, by default, is set to "Caclulate on Bar Close = false" which makes it system intesive because it calculates on every tick. You might try setting "Calculate on Bar Close = true" in the indicator settings and see if that works better for you (system wise) and then compare the two versions. I think that you will find that they are very similar after a few bars. Maybe it will meet your needs.