llblaw 17 posts msg #81303 - Ignore llblaw |
10/17/2009 7:33:20 PM
I am trying a very simple filter. I want to find stocks where the high closed above the upper bollinger band (16,2.5) and for the previous 5 days the close is below the upper bollinger band.
This is what I wrote. It does not work. What am i doing wrong. I guess I need to take a course in Boulean Logic.
price is between 2 and 8
and high is above upper bollinger band(16,2.5)
and 1 day ago high was below upper bollinger band (16,2.5) for 5 days
All help will be appreciated
|
Kevin_in_GA 4,599 posts msg #81307 - Ignore Kevin_in_GA modified |
10/17/2009 8:21:07 PM
I'm sure there is a more elegent way to code this but this should work:
Kevin
I get 52 hits running this filter.
unless you mean this -
I get 49 hits on this version.
Kevin
|
trendscanner 265 posts msg #81330 - Ignore trendscanner |
10/18/2009 9:49:07 AM
This also works
|
llblaw 17 posts msg #81348 - Ignore llblaw |
10/18/2009 3:52:18 PM
Thank you both. Trendscanner can you explain the Count function 6 >4.5 I had tried a count function . I think that the 6 is effectively 6 days ago, but what is the less than 4.5 Thank you for your help..
|
Kevin_in_GA 4,599 posts msg #81350 - Ignore Kevin_in_GA |
10/18/2009 3:56:23 PM
It means that within the last six days, the close must be below the upper BB in five of them. Since you already know that the close today was above, by default the last five closes must have been below the upper BB for the statement to return any stocks.
|
llblaw 17 posts msg #81352 - Ignore llblaw |
10/18/2009 4:20:52 PM
Thank you again. But why 4.5 and not 5
|
trendscanner 265 posts msg #81368 - Ignore trendscanner |
10/19/2009 8:59:41 AM
llblaw, the explanation that Kevin gives above is spot-on. The easiest way to see why to use 4.5 instead of 5 in the filter is to substitute 5 for 4.5 and see what stocks are returned.
The SF programming language takes a little effort to get familiar with. The manual is helpful.
|
Kevin_in_GA 4,599 posts msg #81369 - Ignore Kevin_in_GA |
10/19/2009 9:10:49 AM
IF IT IS EASIER TO THINK ABOUT ANOTHER WAY, JUST SET THE COUNT FUNCTION EQUAL TO 5.
This condition, along with the condition that today's close was above the upper BB, should work just as well.
|