StockFetcher Forums · Filter Exchange · How to filter out bull/bear markets?<< >>Post Follow-up
cunparis
71 posts
msg #64665
Ignore cunparis
7/3/2008 5:22:04 PM

I have filters that work best in bull/bear markets but the problem is how to determine which one? I've used things like 60 day slope but what happens is this misses the beginning and is valid too long at the end. I'd like my filter to just not return any results if we're in the wrong market. Is it possible?



rtucker
318 posts
msg #64687
Ignore rtucker
modified
7/3/2008 10:44:27 PM

Maybe something like this? Take away the offset 30 and you get no
returns.

Fetcher[set{SPYtest, count(ind(SPY,close) is above ind(SPY,MA(50)),1) }

SPYtest > 0
draw ma(50)

cog(5,2) crossed above 0

offset 30
]




cunparis
71 posts
msg #64701
Ignore cunparis
7/4/2008 2:30:44 AM

I don't really understand your example.

this is what I'm testing right now. It works but lags a bit for entry and exit.

ind(SPY, MACD fast line(12,26)) is below ind(SPY, MACD slow line(12,26))


rtucker
318 posts
msg #64702
Ignore rtucker
7/4/2008 4:59:11 AM

As I understand you, you seem to already have what you are looking for.

Here is another simple example below:

When this code is included in any filter, if the stochs(39) of SPY is above 50 its value is 1 . When LONG = 1 "and" your filter conditions are met, stocks will be returned. Now , the trend is your friend and trade long.

When the stochs(39) of SPY is below 50 (LONG = 0) then dont make the long trades because the general market is falling. Or, trade short.

ma(50) and stochs(39) are two of many ways to do this. Maybe try ADX levels, parabolic sar crosses, ma crossovers etc....

IF you backtest, this can help you develop .... say a long strategy, that doesnt continue to take long trades during a market selloff (stochs(39) of SPY below 50) when the value of your "trend" is 0.

The date offset of 30 is required because of the condition "LONG is above 0" . LONG was above zero 30 days ago, .... today it isnt, so, nothing would be returned by your filter.

This could be tried as a simple "stop and reverse" method. Oh oh........there I said it !

Hope that helps.

Fetcher[set{LONG, count( ind(SPY, slow stochastics(39)) is above 50,1)}

LONG above 0
offset 30
]





chetron
2,817 posts
msg #64707
Ignore chetron
modified
7/4/2008 10:13:46 AM

comparision thing.....


Fetcher[

set{SPYtest, count(ind(SPY,close) is above ind(SPY,MA(50)),1) }
set{cunparistest,count(ind(SPY, MACD fast line(12,26)) is below ind(SPY, MACD slow line(12,26)),1)}
set{LONG, count( ind(SPY, slow stochastics(39)) is above 50,1)}

cunparistest > .5
spytest > .5
LONG above 0

draw ma(50)

cog(5,2) crossed above 0


]





Fetcher[

/* TACHIKAWA */

set{SPYtest, count(ind(SPY,close) is above ind(SPY,MA(50)),1) }
set{cunparistest,count(ind(SPY, MACD fast line(12,26)) is below ind(SPY, MACD slow line(12,26)),1)}
set{LONG, count( ind(SPY, slow stochastics(39)) is above 50,1)}

draw ma(50)

cunparistest 1 day ago < .5
spytest > .5
LONG above 0
cunparistest > .5

cog(5,2) crossed above 0


]



StockFetcher Forums · Filter Exchange · How to filter out bull/bear markets?<< >>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.