Good Afl for Intraday but......

#1
I am very new in market.
I have one afl those give good result in intraday backtesting but some time show fake call.
Any one can correct these afl and remove fake call or any other option how to use these afl for trading. afl is below.


_SECTION_BEGIN("123");
z=Param("zig",0.4,0.01,3,0.01);
Plot(C,"",colorLightGrey,styleBar);
Plot( Zig(C, z), _DEFAULT_NAME(), colorYellow, styleLine );

p=Peak(C,z,1);
t=Trough(C,z,1);

Buy=Cross(C,p);
stop=ValueWhen(Buy,t,1);
Entry=ValueWhen(Buy,p,1);
Target=(Entry+(Entry-stop));
Sell=Cross(stop,C) OR Cross(t,C) OR Cross(C,Target);

Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

PlotShapes(shapeUpArrow*Buy,colorGreen,0, L);
PlotShapes(shapeDownArrow*Sell,colorRed,0, H);

Short=Cross(t,C)AND TimeNum();
stop1=ValueWhen(Short,p,1);
Entry1=ValueWhen(Short,t,1);
Target1=(Entry1-(stop1-Entry1));
Cover=Cross(C,stop1) OR Cross(C,p) OR Cross(Target1,C);

Short = ExRem( Short, Cover );
Cover = ExRem( Cover, Short );

PlotShapes(shapeSmallUpTriangle*Cover,colorRed,0,L);
PlotShapes(shapeSmallDownTriangle*Short,colorGreen,0,H);
Buy=Cross(C,p);
stop=ValueWhen(Buy,t,1);
Entry=ValueWhen(Buy,p,1);
Target=(Entry+(Entry-stop));
Sell=Cross(stop,C) OR Cross(t,C) OR Cross(C,Target);

Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

PlotShapes(shapeUpArrow*Buy,colorGreen,0, L);
PlotShapes(shapeDownArrow*Sell,colorRed,0, H);

Short=Cross(t,C)AND TimeNum();
stop1=ValueWhen(Short,p,1);
Entry1=ValueWhen(Short,t,1);
Target1=(Entry1-(stop1-Entry1));
Cover=Cross(C,stop1) OR Cross(C,p) OR Cross(Target1,C);

Short = ExRem( Short, Cover );
Cover = ExRem( Cover, Short );

PlotShapes(shapeSmallUpTriangle*Cover,colorRed,0,L );
PlotShapes(shapeSmallDownTriangle*Short,colorGreen,0,H);
_SECTION_END();
 

mastermind007

Well-Known Member
#2
I am very new in market.
I have one afl those give good result in intraday backtesting but some time show fake call.
Any one can correct these afl and remove fake call or any other option how to use these afl for trading. afl is below.


_SECTION_BEGIN("123");
z=Param("zig",0.4,0.01,3,0.01);
Plot(C,"",colorLightGrey,styleBar);
Plot( Zig(C, z), _DEFAULT_NAME(), colorYellow, styleLine );

p=Peak(C,z,1);
t=Trough(C,z,1);

Buy=Cross(C,p);
stop=ValueWhen(Buy,t,1);
Entry=ValueWhen(Buy,p,1);
Target=(Entry+(Entry-stop));
Sell=Cross(stop,C) OR Cross(t,C) OR Cross(C,Target);

Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

PlotShapes(shapeUpArrow*Buy,colorGreen,0, L);
PlotShapes(shapeDownArrow*Sell,colorRed,0, H);

Short=Cross(t,C)AND TimeNum();
stop1=ValueWhen(Short,p,1);
Entry1=ValueWhen(Short,t,1);
Target1=(Entry1-(stop1-Entry1));
Cover=Cross(C,stop1) OR Cross(C,p) OR Cross(Target1,C);

Short = ExRem( Short, Cover );
Cover = ExRem( Cover, Short );

PlotShapes(shapeSmallUpTriangle*Cover,colorRed,0,L);
PlotShapes(shapeSmallDownTriangle*Short,colorGreen,0,H);
Buy=Cross(C,p);
stop=ValueWhen(Buy,t,1);
Entry=ValueWhen(Buy,p,1);
Target=(Entry+(Entry-stop));
Sell=Cross(stop,C) OR Cross(t,C) OR Cross(C,Target);

Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

PlotShapes(shapeUpArrow*Buy,colorGreen,0, L);
PlotShapes(shapeDownArrow*Sell,colorRed,0, H);

Short=Cross(t,C)AND TimeNum();
stop1=ValueWhen(Short,p,1);
Entry1=ValueWhen(Short,t,1);
Target1=(Entry1-(stop1-Entry1));
Cover=Cross(C,stop1) OR Cross(C,p) OR Cross(Target1,C);

Short = ExRem( Short, Cover );
Cover = ExRem( Cover, Short );

PlotShapes(shapeSmallUpTriangle*Cover,colorRed,0,L );
PlotShapes(shapeSmallDownTriangle*Short,colorGreen,0,H);
_SECTION_END();
First, the code in your AFL is repeated. No need to have the code shaded in red.

Second, for you to have stable signals, you need to postpone actual entry by one candle to minimize the risk of damage caused by repainting.

Third, Peak, Trough and Zig functions do look into future so little repaint will generally exist. You need to learn to live with that.
 
Last edited: