| Market Profile Are you a market profile trader? Post here. |
![]() | | Tweet | |
| | #65 | ||
![]() | Re: Trading with Market Statistics. IV Standard Deviation Cheers, Nick. | ||
| |
|
| | #66 | ||
![]() | Re: Trading with Market Statistics. IV Standard Deviation http://en.wikipedia.org/wiki/Algorit...ating_variance I added in the volume weighting (using a couple of methods) but could make none match exactly with method one. I hesitate to say this but I wonder if multiplying the squares by the barvolume/total sample volume is mathematically 'valid'? The more pressing question is should the ratio Bar Vol/Tot Vol use the complete sample size volume for its calculation I guess the answer is yes again. Does it make sense (math wise) to multiply the Square by price too? I favour the last algorithm however the bands seem slightly narrower than looping through the sample each time. X is the price and mean is the VWAP which plots perfectly. n = 0 mean = 0 S = 0 foreach x in data:...//i.e each time we get a new bar ..n = n + 1 ..delta = x - mean ..mean = mean + delta * Weight ..S = S + delta*(x - mean) ........... // Note This expression uses the new value of mean end for variance = S/(n - 1) Anyone have any ideas? BTW I have lots of great code but am loath to post it until I resolve this issue. BTW above Weight is Volume/TotalVolume. BUT Total Volume is the total for the series to that point. I am convinced if it is mathematically valid there must be a way to calculate variance correctly as each bar arrives without scaning the whole series. I can do that for the VWAP and a regular SD its just the weighting that causes issues. Cheers, Nick. Cheers. | ||
| |
|
| | #67 | |||
![]() | Re: Trading with Market Statistics. IV Standard Deviation Quote:
Think of it this way. A 10 contract trade can be thought of as ten 1-contract trades. To compute the variance you would have to include all 10 contract trades in the variance computation. That's identical to multiplying the square by 10. Quote:
Quote:
__________________ JERRY ---I'm going to trade til I'm 100, or die trying---- | |||
| |
|
| | #68 | ||
![]() | Re: Trading with Market Statistics. IV Standard Deviation The last question was meant to be "does it make sense to multiply the square by volume as well". Multiplying the price by normalised volume makes sense as you illustrated above it is the whole basis for the VWAP. You can see what it actually is and why its done. Multiplying the square by the normalised volume I can't get my head round. The square is just an intermediate number used in the calculation. In fact if you are multiplying the sum by vol and the sum of the squares when you take the difference they largely cancel out (but not completely). Why not divide the sum by normalised volume or multiply and then square? The other thing is that all of the ways of calculating variance (except just re totalling the series when you get a new data point) seem to produce a slightly different (but consistent result). I presume there are proofs for all these formula adding in the weighting seems to break them all. Unless I am doing it wrong which is highly likely. Still kinda tearing my hair out. EDIT: Another thought wherever you normalise price with the VWAP (Price-VWAP) You are taking into account the volume as it is already factored into the VWAP. I wish my maths was better to actually work through the proofs. Last edited by BlowFish; 08-22-2007 at 01:08 PM. | ||
| |
|
| | #69 | ||
![]() | Re: Trading with Market Statistics. IV Standard Deviation Quote:
__________________ JERRY ---I'm going to trade til I'm 100, or die trying---- | ||
| |
|
| | #70 | ||
![]() | Re: Trading with Market Statistics. IV Standard Deviation Thanks for your indulgence on this. I appreciate it. On the plus side I understand a lot more about the math behind things! (Clearly still not enough). I am hunting for an arithmetician as I type. Let me just say how I got started on this. It was precisely because of performance issues. Basically using the code by Dbtina and Nick the code was too slow when loading on a tick chart. It takes about 10 minutes to process a few days of ticks. Once running its OK but for every tick it needs to process every bar back to the start of the day. Having re-done the PvP code (that used to have the same speed issues) and getting pretty massive performance gains, I figured I would try this. A lot tougher! Actually on YM the various results are close enough and I think the difference can be attributed to rounding errors (again the non-iterative code is superior in this respect). I'll post a couple of screens and challenge anyone to detect which is which. I would have said I was done...except.... The DAX subjectively looks 'different'. The lines track but sometimes end up a handful of ticks apart. Its perplexing. I think I'll go ahead and 'publish' I reckon its solid code and there are a couple of neat bits. Next thing a super efficient histogram (again the plan is to make it tick precise and perform OK) I have a couple of ideas how to approach that without iteration too. So which is the real SD blue plot or yellow plot? ![]() ![]() Actually I think I can spot them apart but i have been staring at these things for 2 days now. | ||
| |
|
| | #71 | ||
![]() | Re: Trading with Market Statistics. IV Standard Deviation | ||
| |
|
| | #72 | ||
![]() | Re: Trading with Market Statistics. IV Standard Deviation How did you get the volume histogram...is that multicharts or something else? dbntina | ||
| |
|
![]() |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trading With Market Statistics.II The Volume Weighted Average Price (VWAP). | jperl | Market Profile | 65 | 02-25-2012 04:02 PM |
| Trading With Market Statistics I. Volume Histogram | jperl | Market Profile | 36 | 02-21-2012 06:23 PM |
| Trading with Market Statistics III. Basics of VWAP Trading | jperl | Market Profile | 73 | 01-03-2012 08:06 AM |
| Standard deviations & Odds | rayk | Market Profile | 2 | 10-07-2006 11:13 AM |
| Trading in a Dull Market | Soultrader | Technical Analysis | 0 | 09-06-2006 11:44 AM |