StockFetcher Forums · Filter Exchange · HELP! Day Range + Gap equals?????? << >>Post Follow-up
James0264
9 posts
msg #31640
Ignore James0264
4/6/2004 3:00:53 PM

I'm trying to figure out how to compute a day range that includes gaps. In other words, I want to include the difference between the previous days high and the current days low BUT only if that difference is a positive number.

Take Research in Motion (RIMM) as an example.

12/22/03 - Prior Day High = \$46.72
12/23/03 - Prior Day Low = \$45.01

12/24/03 - Current Day High = \$69.93
12/24/03 - Current Day Low = \$58.30

The difference between the Current Day Low of \$58.30 and the Prior Day High of \$46.72 equals \$11.58. I want to add this to the Current Days Range of for a Gap Range of \$23.21.

Any thoughts?

cegis
235 posts
msg #31642
Ignore cegis
4/6/2004 7:54:52 PM

James,

How 'bout this:

Fetcher[set{mygap,high 1 day ago - low}
set{ispos,count(mygap is greater than 0,1)}
price is between 30 and 50
and volume 30 day low is greater than 100000
]

Explanation:

The first line calculates what the day-to-day gap is.

The second line, which is the "trick", uses count() to determine if the gap is greater than zero. Here, count will return zero if it is not [technically, over the past 1 day - the second parameter to count], or one if it is greater than zero.

The third line - the second part of the "trick" multiplies gap by ispos. This will give you either zero (if gap is <= 0) or the gap (if gap > 0)

The fourth line adds the positive gap (or zero) to the day range. This is the value you are looking for!

The rest is just to illustrate what's going on. Add your filter here...

HTH,

C

 hylbert476 postsmsg #31643- Ignore hylbert47 4/6/2004 8:25:28 PMCegis, Can see that you enjoy writing filters. On many threads I see that. Have never seen you mention a stock though. Do you actually trade some too?
cegis
235 posts
msg #31646
Ignore cegis
4/7/2004 9:51:58 AM

hylbert47,

First off, you're right - I do like writing filters, particularly like this one where a not-so-obvious tactic is involved! <G> I also like teaching others the skill, which is why I sometimes don't answer filter questions directly, but instead point the person in the right direction.

And, yes, I do trade - daily. To be honest, my preferred trading strategy is short term (next month) deep in the money covered calls. Made a real good buck with them last year. And they don't require the "baby sitting" that short term trading requires. Unfortunately, lately, the time premiums on calls haven't been what I look for, so have only been in a few positions over the past few months.

I have been trying several different TA strategies of late, with mixed results. I'm still fairly new to TA, and although I do (try) to base my trades in part on TA, I'm not confident enough in my analysis to publicly predict what might happen to any particular stock. <G> Do you know anyone who IS good at this stuff that would like to be my mentor??

MAYBE, when I get more consistent results, I MIGHT post some possible suggestions. However, I'm not certain that does anyone a whole lot of good. I truly believe that each trader needs to develop their own style. Seeing a stock mentioned on some bulletin board doesn't help the reader understand HOW that selection was made, or how it should be played (well, for the most part anyway). Then there's the "public humiliation" for the poster if they are wrong. Sure, they can brag on a "big hit", but that's not my style. (The "being wrong" part dosen't bother me a whole lot, either. It's a common afliction among us mortals.) The only thing I need to know I'm good at what I'm doing is the ever-increasing balance in my brokerage account! <G>

C

James0264
9 posts
msg #31648
Ignore James0264
4/7/2004 10:15:22 AM

Cegis,

All I can say is.......you know your Stockfetcher! Nice coding! I did make one modification though since it was returning a negative number.

I changed this:
set{mygap,high 1 day ago - low}

To this:
set{mygap,low - high 1 day ago}

I also added the following lines to eliiminate stocks with no gaps:
mygap is greater than 0

Thanks again for your efforts! They are greatly appreciated!

cegis
235 posts
msg #31649
Ignore cegis
4/7/2004 11:28:20 AM

James,

> All I can say is.......you know your Stockfetcher! Nice coding!

Thanks. It must be that 30+ years of computer programming under my belt <G>...

> I did make one modification though since it was returning a negative number.

Good catch! Yes, your modification makes the calculations correct...

> I also added the following lines to eliiminate stocks with no gaps: mygap is greater than 0

Like I said in the original post, the filter given was to show you how to do what you were looking for, and to show the results of the set{}s, so you could understand what was going on. The actual "filter" part was just to limit the number of stocks returned based on (very) rudimentary factors...

> Thanks again for your efforts! They are greatly appreciated!

Your welcome. Do I get the first \$100 you make on the filter??? <VERY BIG GRIN> Just kidding! Glad I could help...

C

hylbert47
6 posts
msg #31650
Ignore hylbert47
4/7/2004 12:16:55 PM

Cegis,

cegis
235 posts
msg #31651
Ignore cegis
4/7/2004 12:46:50 PM

hylbert47,

Sorry, but I'm not going to post my e-mail address. I'd get inundated with filter requests! (Hay, wait! Maybe I can turn that into a business! I'll take just 1% of the gain from profitable trades! Hummmmmmm.....)

What kind of suggestions do you have? Individual stocks?? Filters with good results??? A good source of TA education??? Or are they for that Mentor position I'm looking to fill!!?

Do you IM? I have AOL and Yahoo IM accounts that I virtually never use, so I might be more inclined to post one of those, if I though the gain would outweigh any potential down side... (I have other ideas on how we could "hook up" off line that we could persue, too.)

Whatcha got in mind?

C

cegis
235 posts
msg #31876
Ignore cegis
4/26/2004 11:10:43 AM

hylbert47,

Somewhat against my better judgement, here's an e-mail address where I can be reached: SFFilterGuy@yahoo.com. So, what are your ideas? (Hopefully, you are, or know of, a mentor for me <G>...)

C

P.S. To anyone who contemplates e-mailing me:

- I set it up explicitly for SF-related e-mail. I don't plan on checking it unless I'm expecting an e-mail...

- If you have a filter question, post it here and don't bother with the e-mail. I read the forums daily, and I am more than happy to help. Keeping the question on SF Forums also allows others to (a) learn, and (b) contribute. The more, the merrier! (I will not answer filter questions via e-mail. Most likely, such e-mail will be ignored.)

- Same goes for TA questions. Besides, if you're asking me TA questions, you're probably asking the wrong guy <G>. I'm still fairly green at TA...

- Don't bother sending me any "hot tips". You'll just get added to my Spam list...

- If this e-mail account gets too much junk, I'll just abandon it.