Type : Function, Name : RMI
inputs: Price(NumericSeries), Length(Numeric), dt(Numeric);
var: jBar(0), dDn(0), dUp(0), UpSum(0), DnSum(0), MuUp(0), MuDn(0);
if (Length > 0) then
begin
dUp = Price[0] — Price[dt];
if (dUp >= 0) then
dDn = 0
else
begin
dDn = -dUp;
dUp = 0;
end;
MuUp = (MuUp[1]*(Length-1) + dUp)/Length;
MuDn = (MuDn[1]*(Length-1) + dDn)/Length;
if (MuUp + MuDn) <> 0 then
RMI = 100*MuUp/(MuUp + MuDn)
else
RMI = 0;
end
else
RMI = 0;
Type : Indicator, Name : RMI Indicator
inputs: Price(Close), Length(20), dt(5);
var: xRMI(0);
xRMI = RMI(Price, Length, dt);
plot1(xRMI, «RMI»);
plot2(70, «OverBought»);
plot3(30, «OverSold»);