StockFetcher Forums · General Discussion · New and need help<< >>Post Follow-up
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:

Fetcher[

price is between 2 and 8
and high is above upper bollinger band(16,2.5)
and high 1 day ago was below upper bollinger band (16,2.5) 1 day ago
and high 2 days ago was below upper bollinger band (16,2.5) 2 days ago
and high 3 days ago was below upper bollinger band (16,2.5) 3 days ago
and high 4 days ago was below upper bollinger band (16,2.5) 4 days ago
and high 5 days ago was below upper bollinger band (16,2.5) 5 days ago
]



Kevin

I get 52 hits running this filter.

unless you mean this -

Fetcher[

price is between 2 and 8
and high is above upper bollinger band(16,2.5)
and high 1 day ago was below upper bollinger band (16,2.5) 1 day ago
and high 1 day ago was below upper bollinger band (16,2.5) 2 days ago
and high 1 day ago was below upper bollinger band (16,2.5) 3 days ago
and high 1 day ago was below upper bollinger band (16,2.5) 4 days ago
and high 1 day ago was below upper bollinger band (16,2.5) 5 days ago
]



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

Fetcher[
price is between 2 and 8
Close is above upper bollinger band(16,2.5)
Count(Close below upper bollinger band(16,2.5), 6) > 4.5
]



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.

StockFetcher Forums · General Discussion · New and need help<< >>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.