Ben ten posted an indicator using only 5 EMA Lengths, I took the concept and applied a 2 Pole butterwoth Filter to 12 lengths similar to the Guppy MMA into a binary format
You can change the APC input to paint the bars depending on which line you input
Code:
Declare lower;
input period1 = 3;
input period2 = 5;
input period3 = 8;
input period4 = 10;
input period5 = 12;
input period6 = 15;
input period7 = 30;
input period8 = 35;
input period9 = 40;
input period10 = 45;
input period11 = 50;
input period12 = 60;
input APC = 0;
Input dotsize = 3;
def a1A = exp(-1.414 * 3.14159 / Period1);
def b1A = 2 * a1A * Cos(1.414 * 3.14159 / Period1);
def coef2A =b1A;
def coef3A = -a1A * a1A;
def coef1A = (1 – b1A + a1A * a1A) / 4;
rec ButterA = if barNumber() < 3 then Close else coef1A * (Close + 2 * Close[1] + Close[2]) + coef2A * ButterA[1] + coef3A * ButterA[2];
def a1AB = exp(-1.414 * 3.14159 / Period2);
def b1AB = 2 * a1AB * Cos(1.414 * 3.14159 / Period2);
def coef2AB =b1AB;
def coef3AB = -a1AB * a1AB;
def coef1AB = (1 – b1AB + a1AB * a1AB) / 4;
rec ButterB = if barNumber() < 3 then Close else coef1AB * (Close + 2 * Close[1] + Close[2]) + coef2AB * ButterB[1] + coef3AB * ButterB[2];
def a1AC = exp(-1.414 * 3.14159 / Period3);
def b1AC = 2 * a1AC * Cos(1.414 * 3.14159 / Period3);
def coef2AC =b1AC;
def coef3AC = -a1AC * a1AC;
def coef1AC = (1 – b1AC + a1AC * a1AC) / 4;
rec ButterC = if barNumber() < 3 then Close else coef1AC * (Close + 2 * Close[1] + Close[2]) + coef2AC * ButterC[1] + coef3AC * ButterC[2];
def a1AD = exp(-1.414 * 3.14159 / Period4);
def b1AD = 2 * a1AD * Cos(1.414 * 3.14159 / Period4);
def coef2AD =b1AD;
def coef3AD = -a1AD * a1AD;
def coef1AD = (1 – b1AD + a1AD * a1AD) / 4;
rec ButterD = if barNumber() < 3 then Close else coef1AD * (Close + 2 * Close[1] + Close[2]) + coef2AD * ButterD[1] + coef3AD * ButterD[2];
def a1AE = exp(-1.414 * 3.14159 / Period5);
def b1AE = 2 * a1AE * Cos(1.414 * 3.14159 / Period5);
def coef2AE =b1AE;
def coef3AE = -a1AE * a1AE;
def coef1AE = (1 – b1AE + a1AE * a1AE) / 4;
rec ButterE = if barNumber() < 3 then Close else coef1AE * (Close + 2 * Close[1] + Close[2]) + coef2AE * ButterE[1] + coef3AE * ButterE[2];
def a1AF = exp(-1.414 * 3.14159 / Period6);
def b1AF = 2 * a1AF * Cos(1.414 * 3.14159 / Period6);
def coef2AF =b1AF;
def coef3AF = -a1AF * a1AF;
def coef1AF = (1 – b1AF + a1AF * a1AF) / 4;
rec ButterF = if barNumber() < 3 then Close else coef1AF * (Close + 2 * Close[1] + Close[2]) + coef2AF * ButterF[1] + coef3AF * ButterF[2];
def a1AG = exp(-1.414 * 3.14159 / Period7);
def b1AG = 2 * a1AG * Cos(1.414 * 3.14159 / Period7);
def coef2AG =b1AG;
def coef3AG = -a1AG * a1AG;
def coef1AG = (1 – b1AG + a1AG * a1AG) / 4;
rec ButterG = if barNumber() < 3 then Close else coef1AG * (Close + 2 * Close[1] + Close[2]) + coef2AG * ButterG[1] + coef3AG * ButterG[2];
def a1AH = exp(-1.414 * 3.14159 / Period8);
def b1AH = 2 * a1AH * Cos(1.414 * 3.14159 / Period8);
def coef2AH =b1AH;
def coef3AH = -a1AH * a1AH;
def coef1AH = (1 – b1AH + a1AH * a1AH) / 4;
rec ButterH = if barNumber() < 3 then Close else coef1AH * (Close + 2 * Close[1] + Close[2]) + coef2AH * ButterH[1] + coef3AH * ButterH[2];
def a1AI = exp(-1.414 * 3.14159 / Period9);
def b1AI = 2 * a1AI * Cos(1.414 * 3.14159 / Period9);
def coef2AI =b1AI;
def coef3AI = -a1AI * a1AI;
def coef1AI = (1 – b1AI + a1AI * a1AI) / 4;
rec ButterI = if barNumber() < 3 then Close else coef1AI * (Close + 2 * Close[1] + Close[2]) + coef2AI * ButterI[1] + coef3AI * ButterI[2];
def a1AJ = exp(-1.414 * 3.14159 / Period10);
def b1AJ = 2 * a1AJ * Cos(1.414 * 3.14159 / Period10);
def coef2AJ =b1AJ;
def coef3AJ = -a1AJ * a1AJ;
def coef1AJ = (1 – b1AJ + a1AJ * a1AJ) / 4;
rec ButterJ = if barNumber() < 3 then Close else coef1AJ * (Close + 2 * Close[1] + Close[2]) + coef2AJ * ButterJ[1] + coef3AJ * ButterJ[2];
def a1AK = exp(-1.414 * 3.14159 / Period11);
def b1AK = 2 * a1AK * Cos(1.414 * 3.14159 / Period11);
def coef2AK =b1AK;
def coef3AK = -a1AK * a1AK;
def coef1AK = (1 – b1AK + a1AK * a1AK) / 4;
rec ButterK = if barNumber() < 3 then Close else coef1AK * (Close + 2 * Close[1] + Close[2]) + coef2AK * ButterK[1] + coef3AK * ButterK[2];
def a1AL = exp(-1.414 * 3.14159 / Period12);
def b1AL = 2 * a1AL * Cos(1.414 * 3.14159 / Period12);
def coef2AL =b1AL;
def coef3AL = -a1AL * a1AL;
def coef1AL = (1 – b1AL + a1AL * a1AL) / 4;
rec ButterL = if barNumber() < 3 then Close else coef1AL * (Close + 2 * Close[1] + Close[2]) + coef2AL * ButterL[1] + coef3AL * ButterL[2];
def CCI1 = (Close-ButterA)/(0.015* stdev(Close,Period1));
def CCI2 = (Close-ButterB)/(0.015* stdev(Close,Period2));
def CCI3 = (Close-ButterC)/(0.015* stdev(Close,Period3));
def CCI4 = (Close-ButterD)/(0.015* stdev(Close,Period4));
def CCI5 = (Close-ButterE)/(0.015* stdev(Close,Period5));
def CCI6 = (Close-ButterF)/(0.015* stdev(Close,Period6));
def CCI7 = (Close-ButterG)/(0.015* stdev(Close,Period7));
def CCI8 = (Close-ButterH)/(0.015* stdev(Close,Period8));
def CCI9 = (Close-ButterI)/(0.015* stdev(Close,Period9));
def CCI10 = (Close-ButterJ)/(0.015* stdev(Close,Period10));
def CCI11 = (Close-ButterK)/(0.015* stdev(Close,Period11));
def CCI12 = (Close-ButterL)/(0.015* stdev(Close,Period12));
plot A1_Dot = if IsNaN(Close) then Double.NaN else 1;
A1_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A1_Dot.SetLineWeight(DotSize);
A1_Dot.AssignValueColor(if CCI1 >=0 then Color.Cyan else Color.Magenta);
plot A2_Dot = if IsNaN(Close) then Double.NaN else 2;
A2_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A2_Dot.SetLineWeight(DotSize);
A2_Dot.AssignValueColor(if CCI2 >=0 then Color.Cyan else Color.Magenta);
plot A3_Dot = if IsNaN(Close) then Double.NaN else 3;
A3_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A3_Dot.SetLineWeight(DotSize);
A3_Dot.AssignValueColor(if CCI3 >=0 then Color.Cyan else Color.Magenta);
plot A4_Dot = if IsNaN(Close) then Double.NaN else 4;
A4_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A4_Dot.SetLineWeight(DotSize);
A4_Dot.AssignValueColor(if CCI4 >=0 then Color.Cyan else Color.Magenta);
plot A5_Dot = if IsNaN(Close) then Double.NaN else 5;
A5_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A5_Dot.SetLineWeight(DotSize);
A5_Dot.AssignValueColor(if CCI5 >=0 then Color.Cyan else Color.Magenta);
plot A6_Dot = if IsNaN(Close) then Double.NaN else 6;
A6_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A6_Dot.SetLineWeight(DotSize);
A6_Dot.AssignValueColor(if CCI6 >=0 then Color.Cyan else Color.Magenta);
plot A7_Dot = if IsNaN(Close) then Double.NaN else 7;
A7_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A7_Dot.SetLineWeight(DotSize);
A7_Dot.AssignValueColor(if CCI7 >=0 then Color.Blue else Color.Red);
plot A8_Dot = if IsNaN(Close) then Double.NaN else 8;
A8_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A8_Dot.SetLineWeight(DotSize);
A8_Dot.AssignValueColor(if CCI8 >=0 then Color.Blue else Color.Red);
plot A9_Dot = if IsNaN(Close) then Double.NaN else 9;
A9_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A9_Dot.SetLineWeight(DotSize);
A9_Dot.AssignValueColor(if CCI9 >=0 then Color.Blue else Color.Red);
plot A10_Dot = if IsNaN(Close) then Double.NaN else 10;
A10_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A10_Dot.SetLineWeight(DotSize);
A10_Dot.AssignValueColor(if CCI10 >=0 then Color.Blue else Color.Red);
plot A11_Dot = if IsNaN(Close) then Double.NaN else 11;
A11_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A11_Dot.SetLineWeight(DotSize);
A11_Dot.AssignValueColor(if CCI11 >=0 then Color.Blue else Color.Red);
plot A12_Dot = if IsNaN(Close) then Double.NaN else 12;
A12_Dot.SetPaintingStrategy(PaintingStrategy.TRIANGLES);
A12_Dot.SetLineWeight(DotSize);
A12_Dot.AssignValueColor(if CCI12 >=0 then Color.Blue else Color.Red);
AssignPriceColor(if APC ==1 and CCI1 >=0 then Color.Cyan Else if APC ==1 and CCI1 <0 then Color.Magenta Else if APC ==2 and CCI2 >=0 then Color.Cyan Else if APC ==2 and CCI2 <0 then Color.Magenta Else if APC ==3 and CCI3 >=0 then Color.Cyan Else if APC ==3 and CCI3 <0 then Color.Magenta Else if APC ==4 and CCI4 >=0 then Color.Cyan Else if APC ==4 and CCI4 <0 then Color.Magenta Else if APC ==5 and CCI5 >=0 then Color.Cyan Else if APC ==5 and CCI5 <0 then Color.Magenta Else if APC ==6 and CCI6 >=0 then Color.Cyan Else if APC ==6 and CCI6 <0 then Color.Magenta Else if APC ==7 and CCI7 >=0 then Color.Blue Else if APC ==7 and CCI7 <0 then Color.Red Else if APC ==8 and CCI8 >=0 then Color.Blue Else if APC ==8 and CCI8 <0 then Color.Red Else if APC ==9 and CCI9 >=0 then Color.Blue Else if APC ==9 and CCI9 <0 then Color.Red Else if APC ==10 and CCI10 >=0 then Color.Blue Else if APC ==10 and CCI10 <0 then Color.Red Else if APC ==11 and CCI11 >=0 then Color.Blue Else if APC ==11 and CCI11 <0 then Color.Red Else if APC ==12 and CCI12 >=0 then Color.Blue Else if APC ==12 and CCI12 <0 then Color.Red Else Color.Current);
You can change the APC input to paint the bars depending on which line you input