| marksteu 6 posts
 msg #44353
 - Ignore marksteu
 | 5/29/2006 1:37:00 AM 
 I have limited knowledge of how to apply the count feature to certain predefined patterns such as:
 set{bulen,count(pattern is bullish engulfing,50)}
 
 But, how do I count how many times the following pattern occurred in a certain time period, say 50 days.
 close has decreased for the last 2 days lag 1 day
 and close is above close 1 day ago
 
 Thanks in advance...
 
 
 
 
 
 | 
| nikoschopen 2,824 posts
 msg #44357
 - Ignore nikoschopen
 modified
 | 5/29/2006 2:14:41 AM 
 Mark,
 
 Welcome to SF.
 
 Let us start by taking a very simple setup to illustrate how count feature, in conjuction with a set statement, may be used to answer ure question. For this example, we'll start with the premise "price crossed above MA(50)".
 
 1) price crossed above MA(50) //this will fetch stocks that crossed above its 50-day moving average
 
 2) count(price crossed above MA(50),50) is above 0 //this will fetch stocks that have crossed above its 50-day moving average at least once in the past 50 days.
 
 3) set{Xover, count(price crossed above MA(50),50)} //here, we're assigning the expression enclosed within the previous count function to "Xover".
 
 4) add column Xover //Now we add a column with the same name to have the StockFetcher tell us how many times the damn stock made the crossover above the MA(50) within the last 50 days. You merely need to look under the column header "Xover" to see the number of times the crossover occured.
 
 ____________
 
 So Here's the entire filter:
 
 
 
 
 
 
 | 
| itrademan 70 posts
 msg #44359
 - Ignore itrademan
 | 5/29/2006 2:48:40 AM 
 I have noticed that pre-defined pattern e.g. diferent triangles do not work in the count sytanx. I have not tested the cup-handle or double-bottom but it seems the 'count' function does  not support these phrases.
 
 Anyone with similar experience?
 
 
 
 | 
| marksteu 6 posts
 msg #44363
 - Ignore marksteu
 | 5/29/2006 10:52:53 AM 
 nikoschopen,
 Thanks for you input, but the example that I am trying to solve is when you want to count the occurences of both of my 2 criteria being satisfied. I am still stumped by my example of a close dropping 2 days in a row followed by an increased close.
 Note that I want to treat the two criteria as one pattern, so I cannot simply separate the two criteria into different count statements and add up the results.
 Any thoughts?
 
 
 
 | 
| stocktrader 294 posts
 msg #44364
 - Ignore stocktrader
 modified
 | 5/29/2006 11:46:17 AM 
 A COMPLETE LOGIC SYSTEM - ANOTHER GIFT FROM AVERY:
 
 http://www.stockfetcher.com/stockdb/fetcher?p=forum&sub=view&fid=1001&tid=28017&start=0
 
 Usage Example:
 
 
 
 
 
 
 
 
 
 
 | 
| marksteu 6 posts
 msg #44367
 - Ignore marksteu
 | 5/29/2006 11:57:39 AM 
 stocktrader,
 Thanks for your help, and I understand how this checks that both criteria are satisfied on one day.
 However, my goal is to extend your statement to count how many times both of these criteria were satisfied over the past 50 days.
 Any thoughts?
 
 
 
 | 
| stocktrader 294 posts
 msg #44370
 - Ignore stocktrader
 modified
 | 5/29/2006 12:51:43 PM 
 Nope, I certainly can't do it.
 We need an expert programmer to attack this....
 
 This does NOT do it, but an attempt:
 
 
 
 
 
 
 
 
 
 
 | 
| lastjohnny 6 posts
 msg #44374
 - Ignore lastjohnny
 modified
 | 5/29/2006 4:56:46 PM 
 set{A, count(close 1 day ago < close 2 days ago, 1)}
 set{B, count(close 2 days ago < close 3 days ago, 1)}
 set{C, count(close > close 1 day ago, 1)}
 set{D, A + B}
 set{X, C + D}
 and count(X > 2.5, 50) > 1
 
 Think this works. . . But your pattern will match a whole lot of stocks. . .
 
 
 
 
 | 
| nikoschopen 2,824 posts
 msg #44376
 - Ignore nikoschopen
 modified
 | 5/29/2006 5:12:20 PM 
 I believe what you are asking for is a "If and only if" conditional. If I can come up with a feasible solution, I'll let you know.
 
 [Edit] On second thought, lastjohnny's reply seems to have done the trick. Enclose the last count function using the set statement, and just add "add column x" to see how many times there have been such occurences within the last 50 days:
 
 set{test,count(X > 2.5,50)}
 test > 1
 add column test
 
 Kudos to you lastjohnny.
 
 
 
 
 
 | 
| stocktrader 294 posts
 msg #44387
 - Ignore stocktrader
 modified
 | 5/29/2006 8:05:38 PM 
 
 
 
 
 
 
 
 |