Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 5/13/2005(UTC) Posts: 715 Location: Midwest, USA
Was thanked: 1 time(s) in 1 post(s)
|
OK. First off, Inertia is supposed to be a smoothed version of RVI. There were TWO versions of RVI (1993 & 1995); I don't know which one your version of MS has. I found both here: http://forum.equis.com/forums/thread/28471.aspx. It plots fine for me, matching the build-in RVI. Next was how to smooth -- according to the manual & help, it is SUPPOSED to be smoothed with "LinRegSlope", but I found that a Simple Moving Average matched the built-in indicator! Here is the code, if you want to play: Code:
{_Inertia}
Periods2:=Input("INERTIA Periods :",2,200,20);
Periods:=Input("RVI Periods :",2,200,14);
SdevPer:=Input("STD Deviation Periods :",2,200,10);
RVIDownH := ((PREV*(Periods-1))+If(ROC(H,1,%)<0,Stdev(H,SdevPer),0))/Periods;
RVIUpH := ((PREV*(Periods-1))+If(ROC(H,1,%)>0,Stdev(H,SdevPer),0))/Periods;
RVIH := ( 100 * RVIUpH ) / ( RVIUpH + RVIDownH);
RVIDownL := ((PREV*(Periods-1))+If(ROC(L,1,%)<0,Stdev(L,SdevPer),0))/Periods;
RVIUpL := ((PREV*(Periods-1))+If(ROC(L,1,%)>0,Stdev(L,SdevPer),0))/Periods;
RVIL := ( 100 * RVIUpL ) / ( RVIUpL + RVIDownL);
RVIall := (RVIL + RVIH) /2;
mov(RVIall,Periods2,Simple);
|