// Downloaded From https://www.WiseStockTrader.com procedure exit_proc(Buy,BuyPrice,TrailLevel,StopLevel,TargetLevel) { global BuyHelpArray; global BuyPriceHelpArray; global SellHelpArray; global SellPriceHelpArray; global LongStopTrailArray; global LongTargetArray; global FlagStorageArray; BuyHelpArray=0; BuyPriceHelpArray=0; SellHelpArray=0; SellPriceHelpArray=0; LongStopTrailArray=Null; LongTargetArray=Null; FlagStorageArray=0; delay=1; slip=TickSize*0; for(i=1;iLongTargetArray[j]) { SellHelpArray[j]=1; SellPriceHelpArray[j]=Max(O[j],LongTargetArray[j])-slip; i=j; break; } else if(j==BarCount-1) { i=BarCount; break; } } } } } //SetBarsRequired(sbrAll,0); TrailLevel=Param("Trail stop %",20,5,20,1); StopLevel=Param("Stop loss %",5,5,20,1); TargetLevel=Param("Target %",10,5,20,1); Buy=Cross(EMA(Close,10),EMA(Close,25)); Buy=Ref(Buy,-1);BuyPrice=Open; exit_proc(Buy,BuyPrice,TrailLevel,StopLevel,targetLevel); Buy=BuyHelpArray; BuyPrice=BuyPriceHelpArray; Sell=SellHelpArray; SellPrice=SellPriceHelpArray; GraphXSpace=5;SetChartBkColor(ColorRGB(0,0,0));SetChartOptions(0,chartShowDates); SetBarFillColor(IIf(C>O,colorGreen,IIf(C<=O,colorRed,colorLightGrey))); Plot(C,"Price",IIf(C>O,colorDarkGreen,IIf(C<=O,colorDarkRed,colorLightGrey)),64,0,0,0,0); PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorDarkGreen,0,L,-15); PlotShapes(IIf(Buy,shapeSmallCircle,shapeNone),colorLightBlue,0,BuyPrice,0); PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15); PlotShapes(IIf(Sell,shapeSmallCircle,shapeNone),colorYellow,0,SellPrice,0); Plot(LongStopTrailArray,"",IIf(FlagStorageArray==1,colorRed,colorBlue),1); Plot(LongTargetArray,"",colorGreen,1);