StockFetcher Forums · General Discussion · Technique: Removing spikes from averages<< >>Post Follow-up
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:

Fetcher[
set{hiv,volume 31 day high / 31}
set{adjvol,average volume(31) - hiv}
set{myvol,adjvol * 1.03333}

price between 3 and 4
and average volume(30) is greater than 100000
and myvol is less than 100000

add column average volume(30)
add column myvol
]



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




yepher
359 posts
msg #34039
Ignore yepher
11/21/2004 2:20:21 PM

Cegis,

Although I am late replying to this post I enjoyed the dissertation. I really like the concept and I believe it is a fundamental practice in statistics. I think this idea would make a really good addition to the SF toolbox.

I would like to have a "custom moving average" much like CMA that would throw out the highest high value of the range and the lowest low value of the rage before calculating the average.

Actually, it would be really nice if there was a parameter in the measure that would allow you to throw out N of those values.




defghca
150 posts
msg #34047
Ignore defghca
11/22/2004 6:55:10 AM

one way to do it for close value would be to use the values inside the bb bands only. adjust the parameters for 95%,99.9% confidence


StockFetcher Forums · General Discussion · Technique: Removing spikes from averages<< >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.