Thanks for the replies.
After thinking ... I guess I'm looking for a algorithm to find trend lines ... Something that examines the peaks and troughs of price movement and attempts to assign trend lines. So it would "detect" a channel, or a flag, or whatever. (I'm more intersted horizontal...