Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
In another thread, a user asked about how to write a PCF to find stocks that are "at or near" their 50-day or 200-day moving average. The tricky part about this is that the term "near" is relative - a $200 stock that is within $1 of its 50day MA is certainly pretty close ... but a $2 stock that is within $1 of its 50dMA is really far away.
So, a method is needed to "normalize" the results across many stocks, and to have a "dynamic" threshold against which you compare things.
There are two common ways of evaluating it: 1) You can measure it versus equity required for the trade, by comparing the closeness to the MA to the price of the stock (as a percentage) 2) You can measure it versus the risk required for the trade, by comparing the closeness to the MA to the typical "wiggliness" of the price
The "closeness" is a simple calculation - just subtract the 50-day moving average from the latest Close: C-AvgC50. Since this number could be positive or negative, let's force it to always show up as positive by using the Absolute Value function: Abs(C-AvgC50). Of course you can do the same thing for the 200-day MA: Abs(C-AvgC200).
If you want to express either of these as a percentage of the Close, just divide by the Close and multiply by 100: 100*Abs(C-AvgC50)/C. This formula is complete. Use it as a PCF or a custom indicator. Small values are close to the MA, relative to the amount of money you must invest per share.
--------------
If however you are more concerned with Risk (ie how much you might lose in the trade over the course of your hold-time), then you should look at how "wiggly" the stock is. Again, we have a relative term here.
The wiggliness (volatility) of the stock must be evaluated in relation to the length of time that you plan to hold the trade. If you are concerned with 50 and 200-day MA's, I assume that you are holding for somewhere between several days to several months ... not just a few minutes.
If your hold time is several days, then you should eval the wiggliness over that kind of timeframe. I'd suggest using 2-4x your average hold time as the sample to draw from. That is, if you typically hold for 10 days, then use 20-40 days as your baseline. If you typically hold for 10 weeks, then use 20-40 weeks as the baseline.
The formula for average wiggliness of a 10-day hold would be based on daily bars, and is very easy to calculate. There are many ways to do this, but the simplest is to use the average of the day's High to Low range for the 30-day sample period. That is: ((H-L) + (H1-L1) + ... + (H29-L29) ) / 30 This is mathematically equivalent to the simpler TC formula: AvgH30-AvgL30
To create your wiggliness-based "close to the 50-day MA" comparative PCF, you divide by this average volatility, instead of dividing by the Closing price. That is: Abs(C-AvgC50) / (AvgH30-AvgL30)
OK ... now you have two different PCF's which can be used to evaluate closeness to the 50-day MA.
--------------
However there is still one loose end. What about the person holding for longer periods, like 10 weeks ... should they eval their "wiggliness risk" the same way? There's a long story behind this, but the answer is, probably not. The wiggles that typically take place in a single day are not necessarily representative of how volatile a stock typically is over a week's period of time.
What we need, for that intermediate-hold timeframe, is a way to eval the volatility that uses weekly bars instead of daily bars.
Since PCF's ONLY know about daily bars, we need to "fabricate" a weekly bar's High and Low using PCF-eze. This is done with the Max and Min functions. The current Weekly range is: MaxH5 - MinL5 That is, the highest High of the last five days, minus the lowest Low of the same period. This is obviously a bigger number than the average of the daily High-Low during the same period ... and is NOT necessarily just 5x that average, since stocks don't move in an orderly fashion (usually).
OK, so how do we find a useful "wiggliness" for a 10-week hold time, based on the past 30 weeks? Just treat the MaxH5 as if it was "High" in the prior long formula (and MinL5 for Low). Note that TC's syntax requires a dot to separate the "daysago" for these functions, in comparison to the Hn-Ln we saw before.
The formula for the 30-week volatility of weekly bars would therefore be (note that 5 days * 29 weeks = 145 days): ( (MaxH5-MinL5) + (MaxH5.5-MinL5.5) + ... + (MaxH5.145-MinL5.145) ) / 30
You still want to compare this to the DAILY bar average, since that's the typical support/resistance line that the industry looks at. So the "closesness vs volatility", this time for the 200-day MA, based on a typical 10-week hold time, would be: Abs(C-AvgC200) / ( (MaxH5-MinL5) + (MaxH5.5-MinL5.5) + ... + (MaxH5.145-MinL5.145) ) / 30 You have to fill in the other terms for the denominator, since I'm too lazy to do it for you :~)
--------------
OK, you have the formulae now ... how to use them? The simplest way is to create TWO PCF's, one based on equity (versus Close) and the other based on risk (versus H-L), and assign them to two Watchlist-tab columns. You can sort on either column, and see the impact of both measurements. Just remember ... low values are good.
However, since you are comparing apples and oranges here (very different denominators), it might be nice to somehow COMBINE the two measures into a single metric (presuming that both equity and risk matter to you). In order to do this, you have to somehow normalize the typical wiggliness to the typical price.
If you scratch your head a while about this, you'll find yourself going around in mathematical circles, until you think about what all this means to your TRADING. The thing that connects the Equity and Risk for your trade is your POSITION SIZE - i.e. how many shares you trade.
The position size is (or should be :~) limited by how much capital you are willing to TIE UP in a given trade, AND/OR by how much money you are willing to LOSE in a given trade.
This *very important* concept is addressed in a pair of letters I wrote to Don Worden that were published in the Worden Report some time ago ... check them out in the Worden Archives: May 22, 2003 and May 23, 2003
There is a formula for Position Size in the first of those two articles that is based on the Equity and Risk limitations which you feel most comfortable with. Let's just use the word "Size" to represent that formula.
This provides a way to get a measure of "closesness" that versus a "normalized composite" of the Closing price AND the wiggliness. The formula is simple: Abs(C-AvgC50) / Size ... where Size is that formula in the Worden Report
Please note that the Worden Report formula itself is a simplification, and presumes a 10-day sample ... you would be advised to modify it accordingly to fit your trading style ... you might even need to use the long "MaxH5-MinL5" approach.
----------------
Whew! all that just to figure out how "close" you are? Well, I must admit I just used the question as a jumping-off point to discuss normalized comparisons, and to point out that both Equity and Risk should be considered in many such cases.
I hope that at least SOME of this discussion has been helpful to you.
Jim Dean
|