StockFetcher Forums · Filter Exchange · Mean Reversion Filter ??<< 1 2 >>Post Follow-up
hcwaustria
10 posts
msg #57364
Ignore hcwaustria
12/2/2007 12:02:02 PM

Does anyone have any ideas on how to build a filter that spits out long/short ideas of stocks in the same sectors based on the mean reversion principle. Or would anyone be willing to share some filters that they had success with in the past. Any help or advice to pull me in the right direction would really be appreciated. Thank you in advance

TheRumpledOne
6,407 posts
msg #57370
Ignore TheRumpledOne
modified
12/2/2007 1:29:09 PM

Fetcher[
/* Mean Reversion Filter - BOTTOMS */

set{CL_LR,close - Linear Regression(60) }

and add column CL_LR
and add column separator
and add column CL_LR 5 day low
and add column CL_LR 13 day low
and add column CL_LR 26 day low
and add column CL_LR 50 day low
and add column CL_LR 200 day low
and add column separator

/* selection criteria */

MARKET IS NASDAQ 100

draw Linear Regression(60)

sort column 5 ascending
]



TheRumpledOne
6,407 posts
msg #57371
Ignore TheRumpledOne
modified
12/2/2007 1:30:49 PM

Fetcher[
/* Mean Reversion Filter - TOPS */

set{CL_LR,close - Linear Regression(60) }

and add column CL_LR
and add column separator
and add column CL_LR 5 day HIGH
and add column CL_LR 13 day HIGH
and add column CL_LR 26 day HIGH
and add column CL_LR 50 day HIGH
and add column CL_LR 200 day HIGH
and add column separator

/* selection criteria */

MARKET IS NASDAQ 100

draw Linear Regression(60)

sort column 5 descending
]



hcwaustria
10 posts
msg #57373
Ignore hcwaustria
12/2/2007 1:51:37 PM

thank you, therumpledone, for your quick response. i am not sure i quite understand what you posted since the 2 filters are the same stocks in reversed order? how am i able to to match long/short positions with each other? if you have a minute could you please explain, thank you

TheRumpledOne
6,407 posts
msg #57377
Ignore TheRumpledOne
12/2/2007 3:32:31 PM

LOL!

Yes, it IS the same stocks because of the selection criteria:

MARKET IS NASDAQ 100

But one filter looks at the lowest values of CLOSE - LINREG(60) and the other filter looks at the highest values!!

BUY LOW, SELL HIGH!!



nikoschopen
2,824 posts
msg #57382
Ignore nikoschopen
12/2/2007 4:01:15 PM

Any indicator with the name that ends with "bands", "channel", or "envelope" is supposed to spit out, or at least spit in the direction of, a mean-ass reversion solution to sending the stock back up towards the average. Bollinger Bands, Keltner Channel, Moving Average Envelope, to name just a few, are those that belong to the mean reversion camp. Would you mind explaining in detail what ure specifically looking for?

hcwaustria
10 posts
msg #57399
Ignore hcwaustria
12/2/2007 7:01:11 PM

yes, nikoschopen, i would love to explain and maybe you can help me further: want i would like to have is a filter for market neutral pairs trading. a filter that helps me find 2 stocks in the same sector with high correlation that are at least 2 standard deviations away from the mean. for example going long citigroup (c) because it underperfomed the trend, and shorting bank of america (bac) because it outperformed the trend, with the hope that both stocks would reverse back to the mean (trend).
in a step further i would like to do this for an entire sector. for example build an entire portfolio of about 40 stocks (20long, 20 short) in the engergy sector or oil sector or transportation sector.....

for technical indicators i would use things like"
RSI, stochastics, bollinger bands, moving averages...
14 day RSI should either be oversold or overbought (under 30 or over 70),
entry point for the trade should be when the stocks are at least 2 standard deviations away from the mean.
any input is really appreciated, thank you



nikoschopen
2,824 posts
msg #57405
Ignore nikoschopen
modified
12/2/2007 8:11:53 PM

Here's a simple screener used to filter a possible pair from the same industry group. For the sake of simplicity, suppose the 20-day moving average is used as the mean. I want to find one leg of the pair currently trading above and the other below MA(20). In our example, you will find a value of either "1" or "-1" in the fifth column labeled "mean". A value of 1 indicates that the stock is trading above its MA(20); a value of -1, below its MA(20). Hence, you'll want to pair up those with a value of 1 to those with -1. Feel free to modify the industry and change MA(20) for any other indicator of ure choice.

Fetcher[
set{up, count(price above MA(20),1) * 1}
set{down, count(price below MA(20),1) * -1}
set{both, up + down}
set{Xover, 1 - count(both equals 0,1)}
Xover above 0
apply to Industry(MONEY CENTER BANKS)
add column both{Mean}
]



hcwaustria
10 posts
msg #57416
Ignore hcwaustria
12/2/2007 9:08:57 PM

nikoschopen, thank you very much for the quick reply and filter.
this is exactly what i was looking for, and a great start for me to play around and match potential longs with shorts.
it amazes me how fast you can build a filter like this.... how long have you been doing this...what is your background? after spending more time on this i am sure i will have more questions and i already thank you for your time and help

nikoschopen
2,824 posts
msg #57466
Ignore nikoschopen
12/3/2007 6:01:41 PM

I'm only glad to help. Let me know if it needs a further improvement.

StockFetcher Forums · Filter Exchange · Mean Reversion Filter ??<< 1 2 >>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.