Scan for consolidation/channel

Discussion in 'Technical Analysis' started by elit, Jan 10, 2007.

  1. elit

    elit

    I want to write a scan that finds stocks that are in a consolidation/rectangle/range/channel, or whatever you
    want to call it.

    I think this can be done by comparing the last, say, 7-10 bars/days prices and if the prices don't deviate from each
    other that much, in other words if the standard deviation is small, then this would flag a consolidation. This could also
    probably be done with the procent change being very small for all the bars. Whatever is easiest to implement, I don't see
    that there would be any difference in any way.

    Would this be effective or can you find any potential problems with this?

    I don't know whether average trading range should be considered too, as the consolidation probably has narrower spread than usual?

    Should only closing price be considered, or does Open, High and Low also need to be considered?
    This is perhaps dependent on how you define a consolidation. Maybe High and Low prices are the ones to be considered only.

    Also I think that I maybe should consider what price has done before the consolidation, if it was trending up/down or
    just zig-zagging all over the place.



    This could probably be improved to consider stocks that are in a channel that is trending up/down.

    I think a solution to this would be if you only check the standard deviation from one bar to the next, then it doesn't matter if the
    channel is 20 bars, and the first bar is lot higher than the last bar, in other words that the channel is trending down.

    Maybe a combination of both could be considered, i don't know.

    I Appreciate any input! :)
     
  2. Once you write the code, changing the variables to account for different pattrn lengths is easy. I do it in a relatively simplistic fashion, probably using too many steps but it works for me.

    The easiest to write is the narrow range setup, ie., today's range is narrower than any day over the previous n days. I use average daily range versus average true range. Many of the candidates from this will be in consolidating patterns. An example of one that isn't is the stock that has had several strong directioanl days and is pausing today. That might filter as a candidate but when you see the chart you'll know immediately to discard it.

    From there you can add requirements. Methods that work are: requiring the highest high and lowest low over n days to be within a certain range; requiring the highs and lows for the previous n days to be less than or equal to and greater than or equal to, respectively, the highest high and lowest low of that nth day. Another is to require today's range to be an inside day. Sorting for triangle patterns requires that highs and lows for n+1, n+2, etc be less than the day previous. Obviously, symmetrical patterns will require both highs and lows, rising and falling patterns have their specific requirements as do ascending and descending right triangles. But... nothing that can't be written using simple Excel or other language.

    These simple ideas cull plenty of candidates. Of course you'll probably want to narrow the list initially by requiring stocks to have a certain amount of volume for liquidity. And you'll want to select stocks from many different sectors if you're going to maintin a portfolio of these candidates. Diversification is still the number one rule.


    Good luck.