Back to TS code links
   Stochastic RSI indicator from John Ehlers
Back to Ehlers links


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 RSI - code compiled by dn
{From 'Cybernetic Analysis for Stocks and Futures' by John Ehlers
RSILength - set the length of the RSI
StocLength - set the length of the Stochastic
WMALength - set the length of the Weighted Moving Average
}
Inputs: RSILength(8), StocLength(8), WMALength(8);
Value1=RSI (Close, RSILength) - Lowest(RSI(Close, RSILength), StocLength);
Value2 = Highest(RSI(Close, RSILength), StocLength) - Lowest(RSI(Close, RSILength), StocLength);
If Value2<> 0 then Value3 = Value1/Value2;
Value4 = 2*(WAverage(Value3, WMALength) - .5);
Plot1(Value4, "StocRSI",blue);
Plot2(Value4[1], "Trig",green);
Plot3(0,"Zero",yellow); Plot4(.8,"",black);Plot5(-.8,"",black);
{
//Below compiled by mmillar July 2004 - //This uses the function _Oscillators coded by mmillar - same results as above
// Using functions is said to be less efficient than direct code so I use above version - dn
Inputs: RSILength(8), StocLength(8), WMALength(8);
Vars: oResult1(0), oResult2(0);
value1=_Oscillators(4, 0, 0, 0, RSILength, StocLength, WMALength, oResult1, oResult2);
Plot1(oResult1, "StocRSI");
Plot2(oResult2, "Trigger");
}