// Downloaded From https://www.WiseStockTrader.com
Perc=Optimize("Percentage Tolerance",1,0,4,0.1);
MAP=Optimize("MA Length", 12,12,150,5);

PercentageP=1+(perc/10);
PercentageN=1-(perc/10);
Buy= Cross(C,(MA(C,MAP)*PercentageP));
Sell= Cross((MA(C,MAP)*PercentageN),C);

Plot(C,"Close",colorWhite,64);
Plot(MA(C,MAP),"",colorBlue,1);

Filter=Buy OR Sell; 



AddColumn(IIf(Buy,BuyPrice,Null)," Buy Signal ", 6.2,1.2,colorGreen); 
AddColumn(IIf(Sell,SellPrice,Null)," Sell Signal ",6.2,1.2,colorOrange); 

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low, High ) );