// Downloaded From https://www.WiseStockTrader.com //Simple Reverse ROC Trading System by Sosrodiningrat @2017 function ParamOptimize(description,defaultVal,minv,maxv,step){return Optimize(description,Param(description,defaultVal,minv,maxv,step),minv,maxv,step);}//parameter and optimizer function revroc(pricetype,periodroc,Valueroc){return ((Valueroc/100)*Ref(pricetype,-periodroc))+Ref(pricetype,-periodroc);}//reverse ROC SetTradeDelays(1,1,0,0);//Buy or Sell on next bar BuyPrice=O;SellPrice=O;//Buy or Sell on next Open b1=ParamOptimize("b1",38,2,50,1);//period for ROC Buy side b2=ParamOptimize("b2",3.1,0.1,5,0.1);//value for ROC Buy side s1=ParamOptimize("s1",30,2,50,1);//period for ROC Sell side s2=ParamOptimize("s2",4.6,0.1,5,0.1);//value for ROC Sellside Buy=Ref(revroc(C,b1,b2),-1)>L AND Ref(revroc(C,b1,b2),-1)<H; Sell=Ref(revroc(C,s1,s2),-1)>L AND Ref(revroc(C,s1,s2),-1)<H; Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy); Plot(SelectedValue(revroc(C,b1,b2)),"",colorBlue,styleLine,0,0,15); Plot(SelectedValue(revroc(C,s1,s2)),"",colorRed,styleLine,0,0,15); Plot(C,"",colorBlack,styleCandle); PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,L,-12); PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-12); //===============================================