I have attempted to write many indicators that scan for price patterns. I use NeoTicker. From my experience, you have to go through many iterations before your mathematical model pulls the same charts that you would visually scanning.
As stated in an earlier post is write down the characteristics of the pattern, develop a formala that represents ther charactersitics, then run it through a scanner and review the returned results. What you will find is that you will have returned charts that match the mathematical model but dont match what your intentions were from a visual standpoint. You can then add filters to remove some of the'noise' that you dont want.
Below is a formula that I use for filtering stocks that are basing. I have went through at least 15 different approaches and this one returns results that I would otherwise pick manually going through charts.
This is a NeoTicker formula but the basic idea is that it looks for stocks in a tight base over the past 5 days and the base must be horizontal.
plot1 := mov(0,AVGPRC(0,data1),"Simple",5) < H(0)*1.0005 and mov(0,AVGPRC(0,data1),"Simple",5) > L(0)*0.9995 and
mov(1,AVGPRC(0,data1),"Simple",5) < H(1)*1.0005 and mov(1,AVGPRC(0,data1),"Simple",5) > L(1)*0.9995 and
mov(2,AVGPRC(0,data1),"Simple",5) < H(2)*1.0005 and mov(2,AVGPRC(0,data1),"Simple",5) > L(2)*0.9995 and
mov(3,AVGPRC(0,data1),"Simple",5) < H(3)*1.0005 and mov(3,AVGPRC(0,data1),"Simple",5) > L(3)*0.9995 and
mov(4,AVGPRC(0,data1),"Simple",5) < H(4)*1.0005 and mov(4,AVGPRC(0,data1),"Simple",5) > L(4)*0.9995 and
mov(5,AVGPRC(0,data1),"Simple",5) < H(5)*1.0005 and mov(5,AVGPRC(0,data1),"Simple",5) > L(5)*0.9995 and
mov(6,AVGPRC(0,data1),"Simple",5) < H(6)*1.0005 and mov(6,AVGPRC(0,data1),"Simple",5) > L(6)*0.9995 and
mov(7,AVGPRC(0,data1),"Simple",5) < H(7)*1.0005 and mov(7,AVGPRC(0,data1),"Simple",5) > L(7)*0.9995 and
H(0) < ((H(0)+H(1)+H(2)+H(3)+H(4)) / 5) * 1.01 and
L(0) > ((L(0)+L(1)+L(2)+L(3)+L(4)) / 5) * 0.99 and
H(1) < ((H(0)+H(1)+H(2)+H(3)+H(4)) / 5) * 1.01 and
L(1) > ((L(0)+L(1)+L(2)+L(3)+L(4)) / 5) * 0.99 and
H(2) < ((H(0)+H(1)+H(2)+H(3)+H(4)) / 5) * 1.01 and
L(2) > ((L(0)+L(1)+L(2)+L(3)+L(4)) / 5) * 0.99