//Tutorial AFL made by Abnash Singh abnash1978@yahoo.co.uk on 24th MArch 2012 // This is a demo AFL only and cannot be used as any kind of trading system. //Temp arrays to help generate buy signals Datex=DateNum(); timex=TimeNum(); Plot(C,"Price",IIf(O>C,colorRed,colorGreen),styleBar); Buy=Cross(C,5260) AND Datex>=1120323 AND timex>120000; Sell=Cross(C,5260) AND Datex>=1120323 AND timex>110000 AND timex<120000; x=ATR(10); //Temporarily blocked to show the SL lines clearly //Plot(EMA(C,5),"",colorGreen,styleLine|styleNoTitle); //Plot(EMA(C,8),"",colorYellow,styleLine|styleNoTitle); stopline=breach1=0; breach1[0]=1; mult=2; //determine stoploss line: stopline=IIf(BarsSince(Buy)30 AND (maxprofit -(C[i]-priceatbuy))>10))) { Cover[i]=1; Lastsell=1; PlotText(WriteVal(C[i]-priceatbuy,1.0),i,H[i]+2*x[i],colorGreen); } if (Lastsell==1)stopline[i]=Null; } Plot(stopline,"",colorPink,styleDashed|styleNoTitle); PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,L-.5*x); PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H+.5*x); PlotShapes(Cover*shapeHollowDownArrow,colorYellow,0,H+.5*x); PlotShapes(breach1*shapeHollowSmallCircle,colorYellow,0,L-1.5*x);