Here's an example I used for a presentation last fall which might give you some ideas.
30 day consolidation scan, narrow range close within +/- 3% of the SMA-20, then breakout above the +5% level
[type is stock] and [1 day ago max (30, close ) <= 1 day ago sma(20, close) * 1.03] and [1 day ago min (30, close ) >= 1 day ago sma(20, close) * .97] and [close > 1 day ago sma(20, close) *1.05]
Note last line could be modified to look for a break in either direction, and [ [close > 1 day ago sma(20, close) *1.05] or [close < 1 day ago sma(20, close) *0.95] ]
hope this gives you some ideas, just adjust the tolerances to fit your needs.