Elliot Wave.afl
X=BarIndex();
p=Param("p",5,5,30,5);
z=Zig(C,p);Plot(C,"C",1,64);
CONDP=PeakBars(C,P)==0;SP=Cum(CONDP);
EP1=ValueWhen(CONDP,C,1);TP1=ValueWhen(CONDP,X,1);
EP2=ValueWhen(CONDP,C,2);TP2=ValueWhen(CONDP,X,2);
EP3=ValueWhen(CONDP,C,3);TP3=ValueWhen(CONDP,X,3);
EP4=ValueWhen(CONDP,C,4);TP4=ValueWhen(CONDP,X,4);
CONDT=TroughBars(C,P)==0;ST=Cum(CONDT);
ET1=ValueWhen(CONDT,C,1);TT1=ValueWhen(CONDT,X,1);
ET2=ValueWhen(CONDT,C,2);TT2=ValueWhen(CONDT,X,2);
ET3=ValueWhen(CONDT,C,3);TT3=ValueWhen(CONDT,X,3);
ET4=ValueWhen(CONDT,C,4);TT4=ValueWhen(CONDT,X,4);
ET5=ValueWhen(CONDT,C,5);TT5=ValueWhen(CONDT,X,5);
// EW definition
EW8=EP3>EP4 AND EP2>EP3 AND EP2>EP1 AND
ET4>ET5 AND ET3>ET2 AND
ET2>ET1 AND ET3>ET4 AND ET4>ET5 AND CONDT;
COLOR=colorBlue;
PlotShapes(shapeDigit8*EW8,color);
G=Cum(CONDP OR CONDT);
GEW=LastValue(ValueWhen(EW8,G));
PlotShapes(shapeDigit7*(G==GEW-1 AND CONDP),color, layer = 0,
yposition = Graph0, offset = 15 );
PlotShapes(shapeDigit6*(G==GEW-2 AND CONDT),color);
PlotShapes(shapeDigit5*(G==GEW-3 AND CONDP),color,layer = 0,
yposition = Graph0, offset = 15 );
PlotShapes(shapeDigit4*(G==GEW-4 AND CONDT),color);
PlotShapes(shapeDigit3*(G==GEW-5 AND CONDP),color,layer = 0,
yposition = Graph0, offset = 15 );
PlotShapes(shapeDigit2*(G==GEW-6 AND CONDT),color);
PlotShapes(shapeDigit1*(G==GEW-7 AND CONDP),color,layer = 0,
yposition = Graph0, offset = 15 );
PlotShapes(shapeDigit0*(G==GEW-8 AND CONDT),color);
Plot(EW8,"",colorPink,2+styleOwnScale);
Plot(z,"",colorRed,styleThick);
Filter=EW8;// explore for all
quotations
AddColumn(C,"C");
GraphXSpace=8;