Back to TS code links
   Stochastic RVI index from John Ehlers
Back to Ehlers links
- rev 100108


Anyone using information or codes on these pages does so at their own risk - no guarantees of stability or profitability are claimed. These codes are all for testing purposes only.

//// Ehlers Stochastic RVI Index - coded by dn -From Cybernetic Analysis for Stocks and Futures - plots same as code below
Var {Inputs}: Length(7),delimiter(80);
Vars: Num(0),Denom(0),count(0),RVI(0),MaxRVI(0),MinRVI(0);
Value1 = ((Close - Open) + 2*(Close[1] - Open[1]) + 2*(Close[2] - Open[2]) + (Close[3] - Open[3]))/6;
Value2 = ((High - Low) + 2*(High[1] - Low[1]) + 2*(High[2] - Low[2]) + (High[3] - Low[3]))/6;
Num = 0; Denom = 0;
For count = 0 to Length - 1 begin
Num = Num + Value1[count];
Denom = Denom + Value2[count];
End;
If Denom <> 0 then RVI = Num / Denom;
MaxRVI = Highest(RVI, Length);
MinRVI = Lowest(RVI, Length);
If MaxRVI <> MinRVI then Value3 = (RVI - MinRvi) / (MaxRVI - MinRVI);
Value4 = (4*Value3 + 3*Value3[1] + 2*value3[2] + Value3[3]) / 10;
Value4 = 2*(Value4 - .5);
Plot1(Value4, "RVI");
Plot2(.96*(Value4[1] + .02), "Trigger", blue);
Plot3(0, "Ref"); Plot4(.01*delimiter,"+80",green); Plot5(.01*-delimiter,"-80",green);

{
//Stochastic RVI Oscillator - coded by mmillar, July 2004 from the book 'Cybernetic Analysis for Stocks and Futures' by John Ehlers
//Length - used by the Stochastic RVI calculation
//plots same as above except uses TS built in _Ocscillators function
Inputs: Length(8);
Vars: oResult1(0), oResult2(0);
value1=_Oscillators(7, 0, Length, 0, 1, 0, 1, oResult1, oResult2);
Plot1(oResult1, "StocRVI");
Plot2(oResult2, "Trigger");
}