Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

jperl

Trading with Market Statistics. IV Standard Deviation

Recommended Posts

Throughout the previous threads ([thread=1962]Part I[/thread],[thread=1990]Part II[/thread] and [thread=2008]Part III[/thread]), I have described the use of a probability distribution in the form of the volume distribution function as a trading tool. The shape of the probability distribution is dynamic, changing with time throughout the trading day. Nevertheless all information relating to price and price action is contained within this distribution function. Anything you want to know about price and price action can be obtained by analysis of the distribution function itself. No extraneous information from other sources is required.

 

We have so far analyzed the distribution in terms of two properties, a)the peak volume price ( PVP ) and b) the volume weighted average price ( VWAP ), which is the mean for the distribution. Both of these are dynamically updated throughout the trading day as the volume distribution function dyanmically changes. In [thread=2008]Part III[/thread], we showed how the relationship between the VWAP and the PVP could be used for an entry technique in a simple newbie VWAP trading strategy.

 

But there is much more that is needed to advance beyond the newbie strategy. In this thread and succeeding threads, we will address the following issues:

 

1)Given an entry point, where should the profit target be set?

2)What other entry points are there beside the VWAP?

3)How can you tell when a reversal may be imminent?

4)When is a breakout imminent?

5)How do you trade the opening?

6)When should you be looking for scalps.?

7)How do you set stoplosses ?

and related to this

a)Should you set stoplosses?

b)when do you scale in?

c)when do you scale out?

d)When do you reverse a trade.?

 

.

While we won't address all these questions in one thread their answers can be obtained by analysis of the volume distribution function. To do so requires that we introduce a third property of the volume distribution function called the Standard Deviation of the VWAP, SD for short. SD is computed from the following equations:

 

attachment.php?attachmentid=2043&stc=1&d=1185245629

where the summation subscript i, runs over all prices in the volume distribution

pi = ith price in the volume distribution

Pi = vi/V is the probability of occurrence of price pi

vi = the volume traded at price pi from the volume distribution

V = total volume for the entire distribution

 

That's a mouthful. If you would like more details about the variance and the standard deviation, see the wikipedia reference

http://en.wikipedia.org/wiki/Variance and references therein.

 

So what does the Standard Deviation tell you?

Well for starters,

SD tells you how far you can expect price to move away from the VWAP.

 

It can be shown (but we won't prove it here ) that computing the SD with respect to the VWAP gives the smallest expectation of price movement.

 

Put another way, if our newbie trader were to initiate a trade at the VWAP (which he/she already knows how to do from [thread=2008]Part III[/thread]), then the obvious place to put his profit target is 1 standard deviation away from his entry price. This is the least he should expect the price action to move price.

 

SD is thus a measure of market volatility for the time period over which the VWAP is computed. This gives NEWBIE a very powerful handle for his trading. If the SD is too small, he should stand aside. If it is too large, requiring a large stoploss, he might stand aside as well, if this frightens him. Too small and too large are of course qualitative terms which NEWBIE will have to decide for himself, but at least now he has a quantitative measure of market volatility and what he can expect when he enters a trade.

 

Watch the attached video ESlongJuly23.swf and see how adding the SD helps NEWBIE set his profit target.

 

After using the SD for profit targets, a light bulb goes off in NEWBIE's head. He realizes something about entry points that he didn't know about before. If he believes what he is thinking, it will totally change his way of trading now and forever. Can you tell what it is?

Check out [thread=2130]part V[/thread] to see what it is.

SD.jpg.d2c2bfe77058d53ca667f8f338383dc2.jpg

ESlongJuly23.swf

Share this post


Link to post
Share on other sites

Jerry,

 

it looks like a 2-minute chart, is that right?

 

also, just to clarify -- the std dev is for all closing 2-min bars that day vs all respective 2-min VWAP closing values for that day?

Share this post


Link to post
Share on other sites

Very interesting, love the videos. Thanks!

 

Just a question to make sure I'm clear on something. When the price is below the VWAP and around the PVP, the reason not to take trades assuming it's going to go back up to the VWAP and possibly up to the SD - is it that the area is considered more 'random' than at around the VWAP? Because my first instinct looking at that video as a newbie is "hmmm well if the price seems to gravitate toward the VWAP and possibly upward to the SD, why wouldn't I enter the trade down here instead of waiting for it to touch the VWAP".

 

So I'm assuming it has to do with less probability and that prices could continue to drop if they are at or lower than the PVP, whereas at the VWAP probability is on your side that it will continue to rise?

Share this post


Link to post
Share on other sites

 

it looks like a 2-minute chart, is that right?

Yes, 2 minute chart, but there is nothing special about using 2 minute chart, you could use any time or type chart you wanted. The volume distribution function would be the same. That's the beauty of market statistics. The VWAP only depends on when you start the computation.

 

also, just to clarify -- the std dev is for all closing 2-min bars that day vs all respective 2-min VWAP closing values for that day?

Not sure what you are asking, but let me state how the SD is computed by example. Suppose it is 12:30. Compute the VWAP from the open until 12:30. The value you get is the 12:30 VWAP value. It is that one value that is used to compute the SD at 12:30 using all prices in the subtraction from the open until 12:30.

As far as what prices to use, in principle it should be the prices for every trade. In practice this is too CPU intensive. Most computations use either the close of each bar or the average (O+H+L+C)/4 of each bar. It is not too critical.

Share this post


Link to post
Share on other sites

 

So I'm assuming it has to do with less probability and that prices could continue to drop if they are at or lower than the PVP, whereas at the VWAP probability is on your side that it will continue to rise?

 

Good observation Unleashed, you are getting the feel for this. You indeed could take a trade at the PVP, but our NEWBIE is not ready for that yet. Trades at the PVP are possible but dangerous. We will discuss this in a later thread when we get to reverse trades and break outs.

Share this post


Link to post
Share on other sites
Does anyone know how i can plot the standard deviation of the vwap on sierra chart

thanks for your help

 

Sorry losfer, not familiar with Sierra. I would recommend that any charting program that is supplying VWAP should be requested to add the standard deviation as a choice. Otherwise you will be in the dark about market volatility.

Share this post


Link to post
Share on other sites

another great video Jerry.

Unleashed, funny thing with what you mentioned because I had the same first instinct as a newb. Its interesting if you compare that to market profile too because wouldnt that basically be like trading the value low pivot in mp if you went with that lower std dev instead of waiting?

 

also, I would think with any package that has vwap and a scripting language that it shouldn't be to hard to gut bollinger band code to get vwap std dev. Even if the package didn't have a std dev function the math would all be done in the bb indicator. You would just have to swap vwap for the ema and kill the back lookup period.

Share this post


Link to post
Share on other sites
working on my EasyLanguage VWAP Std Dev code (Tradestation)... gotta figure out the trick to how you do summation of all prices since the opening bar. if someone knows how to do this, please help out. here is what my ES chart looks like today:

 

http://bp3.blogger.com/_5h-SWVGx6Ms/RqafxOvXa3I/AAAAAAAAAVk/quoPPnj8Z3I/s1600-h/ES+VWAP+Std+Dev+Bands.bmp

 

Are you using the VWAP that is on tradestation boards ? and from there on aplying sd ?...

Share this post


Link to post
Share on other sites

<<Are you using the VWAP that is on tradestation boards ? and from there on aplying sd ?...>>

 

VWAP_H is the code I am using -- Tradestation has this as a keyword. indicator can be written simply as:

 

plot1(vwap_h,"vwap");

 

--------------

 

here is how I wrote Std Dev:

 

first taking the squared difference of 'price' and VWAP_H and summing them:

 

value1=

square(c-vwap_h)+

square(c[2]-vwap_h[2])+...

 

then taking square root of value1 gives you std dev, written in EL as:

value2=squareroot(value1/n);

 

where n is the number of periods...

 

I just put it up on the tradestation forum to try to get some help:

 

https://www.tradestation.com/Discussions/Topic.aspx?Topic_ID=66888

 

any help here would be appreciated...

Share this post


Link to post
Share on other sites

here is how I wrote Std Dev:

 

first taking the squared difference of 'price' and VWAP_H and summing them:

 

value1=

square(c-vwap_h)+

square(c[2]-vwap_h[2])+...

 

then taking square root of value1 gives you std dev, written in EL as:

value2=squareroot(value1/n);

 

where n is the number of periods...

 

 

Dogpile, you left out an important term in your variance computation. Remember that the VWAP is volume weighted. so you need to weight each one of your square terms by the normalized volume:

value1= Pi*square(c-vwap_h) +..... where Pi= vi/V, vi=volume traded at price c, V=total volume for the distribution.

 

Also each of the terms in the sum should be the same VWAP :

 

value1= P1*square(C-VWAP) + P2*square(c[2]-VWAP) + .....

Share this post


Link to post
Share on other sites

thx Jerry,

 

note that VWAP_H is hard-coded to already volume-weight for that side of the equation.

 

I assume you are saying that I need to weight each 'price' observation by volume as well to be consistent? hmm, need to think about this more. can you post a chart of your ES 2-min chart with the bands for today? I would like to see how mine and yours compare as is...

 

I have been using VWAP a lot lately and using my short-term trading techniques in conjunction with VWAP has so far been awesome -- and I will be thinking a lot about more ideas with VWAP. Look how NQ stopped just short of previous days VWAP again near 55.00 to offer a spot to look for a key reversal... this was sweet since my short-term entry techniques didn't signal a short until then anyway -- but gave extra confidence that this was actually typical behavior for the very volatile NQ contract.

Share this post


Link to post
Share on other sites

<<Also each of the terms in the sum should be the same VWAP :

 

value1= P1*square(C-VWAP) + P2*square(c[2]-VWAP) + .....>>

 

this is not intutive to me... I would then be comparing the current vwap to old prices..

 

I am thinking about how bollinger bands work here and applying same concept. I am quite familiar with properties of bollinger bands so this is natural for me. bollinger bands compare the price to the moving average value that occured at the same time that the price occured. this is kind of like 'matching' concept in accounting.

 

I do not know how to code it your way so will look for others for help. But this entire line of thinking is quite stimulating for new ideas.

Share this post


Link to post
Share on other sites

Jerry,

I am also confused with

"Also each of the terms in the sum should be the same VWAP" statement.

 

Vwap is developing during the day, and is a sum of (pi * vi)/ V. It would seem that SD equitation should have VWAPi and be summed at each bar. So one would get distribution of prices in reference to VWAP line.

Share this post


Link to post
Share on other sites

I like the strategy that you use but the only thing that I seem to find a bit wrong with it is that you seem to really need to wait a long time for the volume distribution function to develop i.e: you have to wait a long time in the trading day to actually do anything.

 

Can you add in another factor into your analysis, specifically time? Question being, if you factor in time then you can do a regression analysis based on price, volume, and time so that you can get a probability distribution (90% confidence intervals) to help time trades early on in the trading session.

 

I might be wrong but it's just an idea :)

Share this post


Link to post
Share on other sites

 

I assume you are saying that I need to weight each 'price' observation by volume as well to be consistent?

Not each price, but each square term in the variance computation

 

I have been using VWAP a lot lately and using my short-term trading techniques in conjunction with VWAP has so far been awesome -- and I will be thinking a lot about more ideas with VWAP. Look how NQ stopped just short of previous days VWAP again near 55.00 to offer a spot to look for a key reversal... this was sweet since my short-term entry techniques didn't signal a short until then anyway -- but gave extra confidence that this was actually typical behavior for the very volatile NQ contract.

 

Glad to see you find the VWAP useful. We have a lot more ideas about this coming up.

Share this post


Link to post
Share on other sites
<<Also each of the terms in the sum should be the same VWAP :

 

value1= P1*square(C-VWAP) + P2*square(c[2]-VWAP) + .....>>

 

this is not intutive to me... I would then be comparing the current vwap to old prices..

 

Yes, that's correct. Think of the following: Suppose you had just one VWAP value say at 12:30 and you wanted to know its variance. You would compute the difference between that value and all the old prices. Take the square of each difference and sum them up to get the unnormalized variance.

Share this post


Link to post
Share on other sites
I like the strategy that you use but the only thing that I seem to find a bit wrong with it is that you seem to really need to wait a long time for the volume distribution function to develop i.e: you have to wait a long time in the trading day to actually do anything.

 

Good observation Nick. There is a solution to this which we will eventually get to in later threads having to do with how you incorporate previous days, weeks, months VWAPs and their SD into todays price action. At this point in time, our NEWBIE trader waits for the distribution to develop and also waits for the price action to touch the VWAP. But, coming up in the next thread, we will introduce a paradigm shift in NEWBIE's thinking. Stay tuned.

 

Can you add in another factor into your analysis, specifically time? Question being, if you factor in time then you can do a regression analysis based on price, volume, and time so that you can get a probability distribution (90% confidence intervals) to help time trades early on in the trading session.

 

Perhaps you might want to expand on this, to give us an idea of what you are thinking about here.

Share this post


Link to post
Share on other sites

<<Suppose you had just one VWAP value say at 12:30 and you wanted to know its variance. You would compute the difference between that value and all the old prices. Take the square of each difference and sum them up to get the unnormalized variance.>>

 

right but when historically charting variance/std dev, don't you want the bands to show what the variance was relative to the distribution at the time of the 'price' reading. for example, lets say you wanted to plot the band that occured at 12:28 (1 bar before 12:30 on a 2-min chart)... you would then want the variance calculated through 1 bar ago, not the 'current' (12:30) VWAP... that is -- you want the distribution up through 12:28 (VWAP_H[1]), not the variance +1 period (the 12:30 VWAP_H) -- right?

Share this post


Link to post
Share on other sites
Jerry,

I am also confused with

"Also each of the terms in the sum should be the same VWAP" statement.

 

Vwap is developing during the day, and is a sum of (pi * vi)/ V. It would seem that SD equitation should have VWAPi and be summed at each bar. So one would get distribution of prices in reference to VWAP line.

 

Nickm, see the reply above to Dogpile. To compute the variance of a group of numbers, find the average of the numbers and then subtract each number from that average, square each difference and sum them up.

Share this post


Link to post
Share on other sites

I think I understand your point.... but it also is not good news from the point of calculating SD, since one has to save values for volume at price ( or whatever unit one will use) for calculating the vi/V element. This makes coding VWAP SD as complex as MP - not a good news for NEWBE:sad:

 

I have come up with crude approximation of SD, by dropping vi/V factor, and it is remarkably close to your pic for July 23rd for whatever it is worth. See the pic attached

VWAP_SD1.thumb.gif.cae25d8ae96288f5c726d181086fcd3d.gif

Share this post


Link to post
Share on other sites

nickm,

 

can I take a look at your code?

 

personally, I like the comparison to 'bollinger bands' -- bollinger bands do not 'volume weight' each observation. yes, it does matter what volume traded where -- but it can also be argued that 'data outliers' are actually more important when doing statistical analysis -- even if they occur on less volume. but you can argue this either way...

 

I think unweighted price versus VWAP_H could be a useful indicator...

Share this post


Link to post
Share on other sites

 

I have come up with crude approximation of SD, by dropping vi/V factor, and it is remarkably close to your pic for July 23rd for whatever it is worth. See the pic attached

 

You can if you wish use a frequency distribution function in place of a volume distribution function. The distributions look similar but will differ in the fine details.

Share this post


Link to post
Share on other sites
nickm,

 

I think unweighted price versus VWAP_H could be a useful indicator...

 

If you are going to use unweighted prices to compute SD, then use an unweighted average to compare it too. Be consistent. Don't compare apples to Oranges.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Topics

  • Posts

    • Candlestick patterns are easier to understand than any other charts in my opinion.
    • Yet being bad at contest but keep participating can be good to perform among the competition showcasing the skills and earning prizes as well. I guess even if there is no prize it helps us measuring our strength.
    • SPOT Spotify stock, top of range breakout at https://stockconsultant.com/?SPOT
    • The income tax saga is even a better example than this but is too long and complicated so...    Things every US citizen should know and remember about Social Security   Short History Lesson on Your Social Security Card . . . Just in case some of you didn't know this... and it doesn't matter whether you are ‘progressive or ‘conservative . . . If you don't believe, Facts are Facts ... it's easy to check out... Franklin Roosevelt, a progressive Democrat, introduced the Social Security (FICA) Program. He promised: 1.) That participation in the Program would be Completely voluntary. No longer Voluntary 2.) That the participants would only have to pay 1% of the first $1,400 of their annual Incomes into the Program. Now 7.65% on the first $90,000. 3.) That the money the participants elected to put into the Program would be deductible from their income for tax purposes each year. No longer tax deductible 4.) That the money the participants put into the independent 'Trust Fund' rather than into the general operating fund, and therefore, would only be used to fund the Social Security Retirement Program, and no other Government program. Under Democrat President Johnson the money was moved to the General Fund and Spent. 5.) That the annuity payments to the retirees would never be taxed as income. Under Democrats Clinton & Gore Up to 85% of your Social Security can be Taxed. Social Security Cards up until the 1980s expressly stated the number and card were not to be used for identification purposes.   Since nearly everyone in the United States now has a number, it became convenient to use it anyway and the message, NOT FOR IDENTIFICATION, was removed. Actually, Democrat President Kennedy and Sergeant Shriver were the first ones to misuse the Social Security account.  They used Social Security funds to start the Peace Corps.   Not the first or last time our money has been taken from American citizens and given to foreign governments. Since many of us have paid into FICA for years and are now receiving a Social Security check every month and then finding that we are getting taxed on 85% of the money we were taxed and paid to the Federal government to 'put away' -- you may be interested in the following: Q: Which Political Party took Social Security from the independent 'Trust Fund' and put it into the general fund so that Congress could spend it? A: It was Lyndon Johnson and the democratically controlled House and Senate. Q: Which Political Party eliminated the income tax deduction for Social Security (FICA) withholding? A: The Democrat Party. Q: Which Political Party started taxing Social Security annuities? A: The Democratic Party, with Al Gore casting the 'tie-breaking' deciding vote as President of the Senate, while he was Vice President of the US Q: Which Political Party decided to start giving annuity payments to immigrants? A:  Jimmy Carter and the Democratic Party.   Immigrants moved into this country, and at age 65, began to receive Social Security payments!   The Democratic Party gave these payments to them, even though they never paid a dime into it! Q: Which Political P arty expanded the scope of the Social Security retirement program to include 'disablities' A:Who fkn cares... Point is that should be an entirely different program... distinct from 'retirement'  program Then, after violating the original contract (FICA), the Democrats turn around and tell you that the Republicans want to take your Social Security away!  Old Soviet / Saul Alinsky trick - accuse the other side of what you are perpetrating...
    • ODP stock, bottom breakout at https://stockconsultant.com/?ODP
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.