| pkm22 6 posts
 msg #40358
 - Ignore pkm22
 | 1/17/2006 8:31:54 AM 
 Does anyone know how to write a filter to find high tight flags?
 I am assuming a 100% price increase within 2 months, consolidation in the area of the price high, and a flag of no longer than 3 weeks.  Any help is appreciated.
 
 
 
 | 
| nikoschopen 2,824 posts
 msg #40364
 - Ignore nikoschopen
 | 1/17/2006 4:06:01 PM 
 This filter will screen for stocks that trade within a tight range as well as within the top 90% of its 3 month range (2 and 3/4 months to be exact, according to your premise). Hence it's not technically a "flag" pattern (I'll save that for another day).
 
 A bit of difficulty encountered with this filter, largely because of nesting problem. To find stocks that advanced at least 200% over the period of 2 months was easy, yet to confine the search with the premise of "rangebound for the last 15 day within the 10% from the top" was challenging. (Again, see below for further note)
 
 
 
 
 
 <<<The problem encountered due to nesting>>>
 
 set{3mo, close 65 days ago}
 set{3wk, high 50 day high 15 days ago}
 set{adv, 3wk / 3mo}
 set{%adv, adv * 100}
 %adv above 199
 set{diff, 3wk - 3mo}
 set{pos90, diff * 0.9}
 set{3wk90, pos90 + 3mo}
 set{cl, count(close between 3wk90 and 3wk,15)} <-- SF would not accept this param
 cl above 10
 
 price above 1
 
 add column 3mo
 add column 3wk
 add column %adv
 
 
 
 
 | 
| pkm22 6 posts
 msg #40366
 - Ignore pkm22
 | 1/17/2006 4:51:51 PM 
 Thanks for the help.  I also tried to write the filter.  Here is what I came up with
 
 set{x, high 2 month high / low 2 month low}
 set{x1, high 2 month high}
 set{y, high 2 month high * 0.8}
 set{z, count(high reached a new 2 month high, 15)}
 show stock where x is greater than 2
 and close is greater than y
 and price is greater than 2
 and 10 day slope of close is less than 0
 and 60 day slope of close is greater than 0
 and z is equal to 0
 chart-time is 6 months
 draw Top Linear Regression Line(15,1)
 draw Bottom Linear Regression Line(15,1)
 
 
 
 
 | 
| nikoschopen 2,824 posts
 msg #40367
 - Ignore nikoschopen
 | 1/17/2006 5:32:36 PM 
 pkm22,
 
 • considering just these lines alone...
 
 set{x, high 2 month high / low 2 month low}
 show stock where x is greater than 2
 
 will screen for stocks that made 200% advance within the last 2 months, starting from today rather than from 3 weeks ago.
 
 • You left the  following 3 lines somewhat dangling without putting them to use...
 
 set{x1, high 2 month high}
 set{y, high 2 month high * 0.8}
 set{z, count(high reached a new 2 month high, 15)}
 
 These are mere conditional statements, like "if". You need to provide the "then" part.
 
 • Variables x, y, z needs to be given a life on their own before you can use them...
 
 show stock where x is greater than 2
 and close is greater than y
 and price is greater than 2
 and 10 day slope of close is less than 0
 and 60 day slope of close is greater than 0
 and z is equal to 0
 
 For instance
 set{x, close}
 set{y, open}
 set{z, MA(50)}
 x is above y and y is above z
 
 Best regards.
 
 
 
 | 
| nikoschopen 2,824 posts
 msg #40368
 - Ignore nikoschopen
 | 1/17/2006 5:36:17 PM 
 Oops...
 
 I retract the x, y, z identity omission (slap, slap, me bad).
 
 
 
 | 
| yepher 359 posts
 msg #40371
 - Ignore yepher
 | 1/17/2006 6:17:49 PM 
 Hmmm....
 
 Could you do something like this?
 
 
 
 
 I know you asked for 100% above some time ago but it did not return any results so I changed it to 20%. Also this one has a 45 day period. You can play with period and window to get close to what you asked for.
 
 -- Yepher
 
 
 
 
 
 | 
| yepher 359 posts
 msg #40372
 - Ignore yepher
 | 1/17/2006 6:18:54 PM 
 Here if a reference page if anyone is interested:
 
 http://www.stockcharts.com/education/ChartAnalysis/flagPennant.html
 
 -- Yepher
 
 
 
 | 
| nikoschopen 2,824 posts
 msg #40376
 - Ignore nikoschopen
 | 1/17/2006 7:17:37 PM 
 Yepher, you're right in that the filter I wrote returned a flimsy number of stocks, if any. Even for those that registered on the radar, when you take out the ones that have a huge gap you essentially have none. Even with the aid of date offset going back 50 days, not much turned up. So I suggest you change the parameters to be more accomodative.
 
 On a side note, I'm not too sure about the "symmetric triangle" phrase offered by
 SF. I have used it in the past, and was none too pleased.
 
 
 
 | 
| rtucker 318 posts
 msg #40440
 - Ignore rtucker
 | 1/19/2006 4:23:16 AM 
 This is an old filter from Mika that seems to catch an occassional high tight flag. The filter sucks but its all in how you trade em.
 
 
 
 
 
 
 
 
 | 
| pkm22 6 posts
 msg #40458
 - Ignore pkm22
 | 1/19/2006 12:04:37 PM 
 nikoschopen,
 
 Thanks for all the help.  Just to clarify if the 2 month high / 2month low is equal to 2 , that is a 100% increase, not 200% as you stated.  Other than that thanks for the input, I'll try to put it to good use.  I'm still learning how to phrase things in SF with the correct syntax.
 
 
 
 |