StockFetcher Forums · General Discussion · counting patterns<< 1 2 >>Post Follow-up
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:
Fetcher[
set{Xover, count(price crossed above MA(50),50)}
add column Xover
sort column 5 descending
]





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
293 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:

Fetcher[set{A, count(close above 100, 1)} set{B, count(volume above 1000000, 1)}
set{X, A + B} show stocks where X equal 2
]








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
293 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:

Fetcher[set{A, count(close has decreased for the last 2 days, 50)}
set{B, count(close is above close 1 day ago, 50)}

set{X, days(close has decreased for the last 2 days, 50)}
set{Y, days(close is above close 1 day ago, 50)}

set{Z, X + Y}
show stocks where Z equal 2

add column A
add column B
add column X
add column Y
add column Z

draw a
draw b on plot a
draw x on plot a
draw y on plot a
draw z on plot a

volume above 1000000
close is between 1 and 10

offset 0
]








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
293 posts
msg #44387
Ignore stocktrader
modified
5/29/2006 8:05:38 PM

Fetcher[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}
set{pass2x,count(X > 2,50)}
Set{pzenith,14}
Set{pnadir,0}

pass2x > 0

add column pass2x

draw pass2x
draw pzenith on plot pass2x
draw pnadir on plot pass2x

volume above 1000000
close is between 1 and 10

and Sort column 5 descending
and chart-length is 5 months

offset 0
]






StockFetcher Forums · General Discussion · counting patterns<< 1 2 >>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 2016 - 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