In response to an earlier post from
@MARIVANILLA on price channels, I thought I would post some scan code that might be useful to find situations where price is approaching upper or lower price channels. Price often modifies its behavior on approaching or crossing a channel - reversing or accelerating the current leg. The hits would be *set ups* - not necessarily entries. Not every hit works out - sometimes none of them work out. You will have to run back scans to learn how to distinguish the better probabilities. See the post for 63 days scans for more.
These scans use Fast Stoch %K, not Upper Price Chan or Lower Price Chan as you might expect. When Fast Stoch %K is used with a second parameter of "1", the result is the position of the close in the price channel of the same look back period expressed as a per cent. So, if a channel is 10 points wide, and the current close is 9 points off the channel low, Fast K would return 90. If the channel were 63 days long (three months), you would use Fast Stoch %K(63,1).
So here are some samples (see other posts for 21, 63 and 251) for various price channel lengths:
***
Channel length is 10 days:
Find stocks where the close or the low has crossed below Fast K 20.
This can be a good set up in a strong up trend
// K10 has been above 80 in past 2 weeks (price has shown some strength)
and [1 day ago max(10, Fast Stoch %K(10,1)) > 80]
// K10 has not been below 20 in past 2 weeks (try to get first crossing)
and [1 day ago min(10, Fast Stoch %K(10,1)) > 20]
and
[
// close crossed into bottom 20% of yesterdays's ten day range
[20 x Fast Stoch %K(10,1)]
or
// low crossed into bottom 20 per cent of yesterday's ten day range
[1 day ago min(10, low) +[ [1 day ago max(10, high) - [1 day ago min(10, low)]] * .2] x low]
]
***
Find stocks where the close or high has crossed above 80
This could be a good short set up in a strong down trend
// K10 has been below 20 in past 2 week (price has shown some weakness)
and [1 day ago min(10, Fast Stoch %K(10,1)) <20]
// K10 has not been above 80 in past 2 weeks (try to get first crossing)
and [1 day ago max(10, Fast Stoch %K(10,1)) < 80]
and
[
// close crossed into top 80% of yesterdays's ten day range
[ Fast Stoch %K(10,1) x 80]
or
// low crossed into bottom 20 per cent of yesterday's ten day range
[today's high x 1 day ago min(10, low) +[ [1 day ago max(10, high) - [1 day ago min(10, low)]] * .8] ]
]