[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: StochRSI



PureBytes Links

Trading Reference Links

> {function}
> Input:
> Price(Numeric),RSILen(Numeric),StochLen(Numeric);
> StochRSI = IFF((Highest(RSI(Price, RSILen), StochLen) - Lowest(RSI(Price,
> RSILen), StochLen)) <> 0,
> (RSI(Price, RSILen) - Lowest(RSI(Price, RSILen), StochLen)) / 
>                 (Highest(RSI(Price, RSILen), StochLen) - Lowest(RSI(Price,
>                 RSILen), StochLen)),
>                  StochRSI[1]);

That will certainly work, but it's not very efficient.  You're 
calling RSI as much as 6 times, Highest and Lowest as much as 
twice.  If you're using it in a system, that inefficiency might 
be an issue.

This will do the trick a bit faster, and it's easier to read:

  Input: Price(Numeric),RSILen(Numeric),StoLen(Numeric);
  Vars: RSIval(0), Hi(0), Lo(0);
  
  RSIval = RSI(Price, RSILen);
  Hi = Highest(RSIval, StoLen);
  Lo = Lowest(RSIval, StoLen);
  
  if (Hi - Lo) <> 0 then 
    StochRSI = 100* (RSIval - Lo) / (Hi - Lo);

Gary





  • References: