StockFetcher Forums · Filter Exchange · Please help me create this filter for a swing trade<< >>Post Follow-up
billcr
5 posts
msg #32057
Ignore billcr
5/13/2004 8:41:39 AM

I am a newbie and would like help in creating
this filter for a swing trade:

1) Up trend in price

2) With monthly new high,

3) Followed by 3 days (or more) of decreasing highs
(ideally open at high and close at low),

4) Followed by high higher than previous session high.

Any help appreciated!
Thanks


cegis
235 posts
msg #32058
Ignore cegis
5/13/2004 9:26:58 AM

Hi billcr,

Welcome! I am of the persuasion that the best way to learn something is to try to do it. So, instead of writing the filter for you, I'll supply some suggestions on where to look. That should get you going, and not waste too much time looking at unrelated "stuff".

1) There are several ways you can filter for this. Try looking at the "slope of" phrase (as in slope of close).

2) If I understand what you are looking for, look at "reached a new..." and "days ago" phrases, and perhaps the "days()" function.

3) Check out "has been decreasing for the past X days", and "days ago" phrases, for the basic test. For the "ideally" part, perhaps the "near" phrase would work for you.

4) Your phrase is almost syntactically correct: You'll want the "days ago" phrase here, too.

Some other pointers:

- Values that you can screen on are (almost?) always named what the "common" name is; i.e., Close, Open, High, Low, Volume, etc., etc...

- Personally, I find the Announcements forum a good place to find the documentation of SF features. However, reading throught the User's Guide is something that you'll wanna do in the not too distant future. It will give you a good "feel" for how filters are constructed. Also, some of the phrases I mentioned above probably won't be in the Announcements section because they are very basic (and have probably been around since day one).

- I'm not sure you'll be able to get a single filter that will work for all desired matches. I say that because of the "(or more)" you have in item (3). It may be do-able, but you might want to start with a simpler filter that looks for the high 4 days ago, followed by exactly 3 days of declining highs, followed by the increase. If you get that far, extending it to span a variable number of days of declines will be easier.

- If you get stuck, post what you currently have, state why - as concicely as possible - it's not to your liking, and tell what you have tried that didn't work. There are many people who visit these forums that are willing to help (myself included, obviously). We particularly like helping those that try to help themselves! <G> Even if you get what you are looking for, feel free to post your filter for comments and suggestions.

- Don't forget to test the filter, by making sure the stocks returned match all of the criteria. SF behaves differently when it doesn't recognise a phrase in a filter, often simply ignoring it. If your filter consistently returns zero results, there's probably something in the filter SF doesn't recognise as well. In this case, build the filter a piece at a time so you can see what phrase SF is having difficulty interpteting. Also "/*" and "*/" can be used to start and stop (respectively) a comment. You can use this to comment out sections of your filter as a method of testing piecemeal.

HTH, and good luck!

C




billcr
5 posts
msg #32066
Ignore billcr
5/13/2004 12:05:13 PM

I appreaciate your help. I will post the filter for review when ready.

Thanks!
Bill




billcr
5 posts
msg #32067
Ignore billcr
5/13/2004 1:01:13 PM

OK, here is what I came up with:

Stock
Fetcher[
/* up trend */
Show stocks where the 200 day Slope of the Close is above 0
and the 50 day Slope of the Close is above 0

/* new monthly high */
and High reached a new 4 week High within the last 1 week

/* 3 days of decreasing highs */
and High 1 day ago had been decreasing for 3 days
and Open is near High within 2 days ago
and Close is near Low within 2 days ago

/* higher high than previous session */
and High is above High 1 day ago

/* optional */
and Average Volume(90) is above 50000
and Close is between 1 and 250
and Stock is optionable
and chart-length is 4 months
]



Any comments/suggestions?


cegis
235 posts
msg #32069
Ignore cegis
5/13/2004 3:06:28 PM

billcr,

Wow! Less than an hour, and you've got your filter (or at least a start). Not bad!

Now for some comments:

I ran the filter, including some backtesting (using the "days offset" phrase), and it always returns zero results. Sounds like there's a syntax error somewhere. I'd use the commenting to take out each and every line (except one), run the filter, then uncomment each line one by one until the results are zero matches. This should point you to the line with a problem (the last one uncommented).

As for how you implemented some of the conditions, I have the following comments:

For the uptrend, you MAY want to use a value greater than 0 for the slope tests. A slope of 0.001 would pass the test, but is basically flat. You'd need to play with limit values here to suit your needs (if 0 is getting too many hits, and some seem false). A slope of 1 indicates the value doubled over the time frame. You MAY want different values for the 200 day vs 50 day slope limits as well...

For the monthly high: I'm not sure about this, but your phrase MAY be looking at weekly highs, since you are using "new 4 week high ... last 1 week". I almost always specify my time frames in days, which in this case I'd use "20 day high within the past 5 days". I'm not sure if this IS how SF interprets your phrase, or if there really is a functional difference, or if you WANT weekly highs for that matter.

For the decreasing highs: Might need to read "HAS been decreasing" (not HAD), but I'm not sure. If you comment this line out (using /* ... */ ) and the results do not change (assuming there are some matches), then SF may be ignoring that part of the filter. (Use backtesting to be sure.) If the number of matches goes from zero to some positive number, then there is a syntax problem here.

For the Open near High/close near low: Again, I'm not sure if the syntax "within 2 days ago" will work (I think that's combining two different phrases that don't combine), or is giving you what you are looking for. Perhaps using something like "count(open 1 day ago is near high 1 day ago,3) is equal to 3" - which should be interpreted as "for each of the past three days, starting 1 day ago, the open was near the high" - is what you are looking for. If you change "is equal to 3" to "is greater than 1", then it would be interpreted as "If, for 2 of the past 3 days, starting 1 day ago, the open is near the high". This last suggestion is in case you don't absolutely require ALL three days to be near the high. Lastly, "near" is a "fuzzy" term. I'm not sure how SF interprets it exactly. (I believe it's described in the User's Manual, tho.) You could also code an explicit definition of near. For example "open divided by high is greater than 0.97" would mean the open would have to be within 3% of the high.

Higher high: Looks good to me...

Optional: Whatever suits ya!

One other thing I'd suggest is using the "add column" phrase so that important values are shown in the list of matching stocks. This will allow you to verify your filter more easily. They can be removed after you're satisfied the filter is working as desired. The set{} command might make the debugging process easier.

HTH,

C


ray-desrochers
2 posts
msg #32075
Ignore ray-desrochers
5/13/2004 6:00:39 PM

StockFetcher scan This looks for a stock that has bounced back up after a 5 day pull back

show stocks where high reached a new 20 day high 6 days ago
and high 5 days ago is below high 6 days ago
and high 4 days ago is below high 5 days ago
and date offset is 0
and high 3 day ago is below high 4 days ago
and high 2 day ago is below high 3 days ago
and high 1 day ago is below high 2 days ago
and close is above high 1 day ago
and stock is optionable
show stocks where close is between 2 and 250

If you don't find stocks today change date offset a day at a time till you do. You may want to find old ones to see how it did after the "trigger"


beand
1 posts
msg #70083
Ignore beand
12/28/2008 11:51:19 PM

billcr:
How you doing with the swing trade filter? You must be an old pro by now. I am the newbie.
Post your latest code?
DB

chetron
2,817 posts
msg #70086
Ignore chetron
12/29/2008 6:42:13 AM

CLICKABLE...

Fetcher[

show stocks where high reached a new 20 day high 6 days ago
and high 5 days ago is below high 6 days ago
and high 4 days ago is below high 5 days ago
and date offset is 0
and high 3 day ago is below high 4 days ago
and high 2 day ago is below high 3 days ago
and high 1 day ago is below high 2 days ago
and close is above high 1 day ago
and stock is optionable
show stocks where close is between 2 and 250

]



Eman93
4,750 posts
msg #70149
Ignore Eman93
12/29/2008 11:48:43 PM

/* up trend */
Show stocks where the 200 day Slope of the Close is above 0
and the 50 day Slope of the Close is above 0

/* new monthly high */
and High reached a new 4 week High within the last 1 week

/* 3 days of decreasing highs */
and High 1 day ago had been decreasing for 3 days
/*and Open is near High within 2 days ago*/
/*and Close is near Low within 2 days ago */

/* higher high than previous session */
and High is above High 1 day ago

/* optional */
and Average Volume(90) is above 50000
and Close is between 1 and 250
and Stock is optionable
and chart-length is 4 months

The filter is valid the last 2 lines of 3 days decrasing highs is showing no matches.....I added the ignore around those two and the filter returned 2 stocks.


chetron
2,817 posts
msg #70152
Ignore chetron
12/30/2008 7:55:54 AM

clickable..

Fetcher[


/* up trend */
Show stocks where the 200 day Slope of the Close is above 0
and the 50 day Slope of the Close is above 0

/* new monthly high */
and High reached a new 4 week High within the last 1 week

/* 3 days of decreasing highs */
and High 1 day ago had been decreasing for 3 days
/*and Open is near High within 2 days ago*/
/*and Close is near Low within 2 days ago */

/* higher high than previous session */
and High is above High 1 day ago

/* optional */
and Average Volume(90) is above 50000
and Close is between 1 and 250
and Stock is optionable
and chart-length is 4 months

]



StockFetcher Forums · Filter Exchange · Please help me create this filter for a swing trade<< >>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.