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

Easy-language slow code



PureBytes Links

Trading Reference Links

The indicator below is the StochRSI of the detrended price.  Problem is that
it takes over 1minute for the indicator to run through all the calculations
and finally be put on the screen.  I'm running 2000i.  Anyone have any ideas
on how to speed this one up?

Regards;
John Hall

{*********************************************************************
Title:  StochRSI of the Detrended price
By: John Hall,  2000
**********************************************************************}

Inputs:detrend_length(90), rsi_length(14), Length(14), BuyZone(.30),
SellZone(.70), BZColor(Green), SZColor(Magenta);
var: value1(0);

Plot1(iff((RSIClassic(detrend(close, detrend_length), rsi_length)-
  lowest(rsiclassic(detrend(close, detrend_length), rsi_length),
rsi_length))= 0,0,
        (RSIClassic(detrend(close, detrend_length),rsi_length)-
  lowest(rsiclassic(detrend(close, detrend_length), rsi_length),
rsi_length))/
   (highest(rsiclassic(detrend(close, detrend_length), rsi_length),
rsi_length) -
     lowest(rsiclassic(detrend(close, detrend_length), rsi_length),
rsi_length))), "RSI");
Plot2(BuyZone, "BuyZone");
Plot3(SellZone, "SellZone");
plot4(average(iff((RSIClassic(detrend(close, detrend_length),rsi_length)-
          lowest(rsiclassic(detrend(close, detrend_length), rsi_length),
rsi_length))= 0, 0,
                (RSIClassic(detrend(close, detrend_length),rsi_length)-
       lowest(rsiclassic(detrend(close, detrend_length), rsi_length),
rsi_length))/
           (highest(rsiclassic(detrend(close, detrend_length), rsi_length),
rsi_length) -
       lowest(rsiclassic(detrend(close, detrend_length), rsi_length),
rsi_length))), length), "RSI ave");

If Plot1 > SellZone then Begin
 Alert("The detrend RSI is in overbought territory");
 SetPlotColor(1, SZColor);
End
Else
 If Plot1 < BuyZone then Begin
  Alert("The detrend RSI is in oversold territory");
  SetPlotColor(1, BZColor);
 End;