cegis 235 posts msg #32493 - Ignore cegis |
7/1/2004 10:46:51 AM
It has always irked me that when I use an average value for filtering, invariably a few stocks are selected that fit the average simply due to a extreme peak in value. For example, using "average volume(30) > 100,000" frequently shows stocks whose peak-excluded average might be 25,000, but on one day in the period had 25,000,000 due to news or some such. I categorically dismiss these, as I look for *consistently* liquid stocks to trade. I frequently use "volume 30 day low > 100,000" to avoid this, but that has "issues" as well, like maybe 1 or 2 days with a volume of 98,000 (which I would consider OK).
So, I have come up with a "workaround" that would ignore a one-day spike in volume. I would appreciate any feedback you may have. Here it is:
This will show stocks where the peak in volume causes the average volume to be above my limit, where if the peak is removed, it would not reach my limit. This is for illustration purposes, and not intended to be a "useful" filter for finding tradable stocks. (When this filter is run for EOD 6/30, NKBS is a perfect example of what I'm talking about.)
Theory of operation:
Using 4 days instead of 30, the average is (v1 + v2 + v3 + v4) / 4. Lets assume v3 is the peak for the period, and we want to remove it. We'd end up with our average being (v1 + v2 + v4) / 3. This is our "target".
Rewriting the original average formula, we get v1/4 + v2/4 + v3/4 + v4/4. We see here that the peak's "contribution" to the average is v3/4. The first set{} command of the filter finds the peak volume of the period, and divides it by the number of days in the average, giving the peak value's "contribution" to the average. The second set{} command removes the peak's contribution from the average.
However, this leaves the calculation of the average as (v1 + v2 + v4) / 4. As you can see, this is no average at all, as we should be dividing by 3, not 4. Therefore, we need to multiply this result by 4/3, to get (v1 + v2 + v4) / 3. The last set{} command, therefore, multiplies by 31/30 (= 1.0333333333...) to get the 30 day adjusted average.
Obviously, this technique can be applied to any value that you wish to average with peaks ignored. It is easily tweeked to exclude valleys as well (use "31 day low" instead of "31 day high"). And the period to average is easilly changed.
The main limitation I see to this technique is if there's a multi-day (2 or 3 days) extreme, this will help some, but not totally.
I would appreciate comments and suggestions as to using this technique in filters and/or it's applicability to TA. Questions are welcome, too.
HTH,
C
|