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

Re: CL_Fast Stochastic Or RSI



PureBytes Links

Trading Reference Links

Obviously, there is a shortcut!
You can compute the highest and lowest values in the same for loop.

Inputs: Price(NumericSeries), Length(NumericSimple);
Variables: Counter(0), MyHigh(-999999);

MyHigh = -999999;
For counter = 0 To Length - 1 Begin
 If Price[Counter] > MyHigh Then
  MyHigh = Price[Counter];
End;

Same calculation for Mylow occurs here
=============================

If Length <= 0 Then
 MyHigh = Price;

Then use MyHigh and Mylow to calculate the %A_K (Amphetamin_ fast K).
Cannot say for the real speed you will get, but it avoids to read
Price[Counter]  two times.


Rgds
Pierre Orphelin
www.sirtrade.com


----- Message d'origine -----
De : Kent Rollins <kentr@xxxxxxxxxxxxxx>
À : CodeList <code-list@xxxxxxxxxxxxx>
Envoyé : Friday, July 28, 2000 03:19
Objet : Re: CL_Fast Stochastic Or RSI


> For RSI calculations, you are supposed to use an "average off" method
where
> SumUp and SumDown are computed using a method similar to the way
exponential
> moving averages are calculated.  Something like this:
>
> SumUp = (SumUp[1] * (Len - 1)) + (Price - Price[1])) / Len
>
> You are not supposed to use a For-loop for RSI calculations.  I don't
think
> there is a shortcut to computing Stochastic values.
>
> Kent
>
>
> -----Original Message-----
> From: Barry Kaufman <102577.325@xxxxxxxxxxxxxx>
> To: code-list@xxxxxxxxxxxxx <code-list@xxxxxxxxxxxxx>
> Date: Thursday, July 27, 2000 3:39 PM
> Subject: CL_Fast Stochastic Or RSI
>
>
>
> I SENT THIS TO OMEGA LIST EARLIER TODAY:
>
> In order to speed up TS optimization, I want to reduce the look-back
> FOR - END looping overhead of the Stochastic and RSI on each bar.  We
> know that this can be done with a simple MA by replacing FOR - END
> lookback, with adding the new bar and subtracting the oldest bar and
> dividing by N.  Is there a similar trick for Stochastic and RSI?  If
> so, please show a snippet of code to point me in the right direction.
>
> Thanks, Barry.
> The Code List -
> Subscribe/Unsubscribe
> http://www.markbrown.com
>
> The Code List -
> Subscribe/Unsubscribe
> http://www.markbrown.com