Cutler’s RSI (Amibroker Code)

The original article can be found here.

Amibroker code for the indicator:

oddis=Optimize(“Days in RSI”,5,2,15,1);
oddis1=Optimize(“Thresholds”,25,5,40,5);

function CutlersRSI(array, periods) {
diff = array – Ref(array, -1);
sumUpward = Sum(IIf(diff > 0, diff, 0), periods);
sumDownward = Sum(IIf(diff < 0, -diff, 0), periods);
rs = IIf(sumDownward > 0, sumUpward / sumDownward, Null);
return 100 – 100 / (1 + rs);
}

SetChartOptions(0, 0, chartGrid30 | chartGrid70);

Plot(CutlersRSI(Close, PeriodRSI), _DEFAULT_NAME(), ParamColor(“Color”, colorCycle), ParamStyle(“Style”));

rsiValue = CutlersRSI(Close, oddis);

Buy =rsivalue<oddis1 ;
BuyPrice = Close;
Sell = rsivalue>100-oddis1 ;
SellPrice = Close ;

The above code has both the backtest and the indicator code.