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!