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

Re: Converting r-squared to simple



PureBytes Links

Trading Reference Links

At 7:49 PM -0500 1/7/99, Cab Vinton wrote:

>I have a function for calculating r-squared which I am unsuccesfully
>trying to convert from series to simple.
>

<Snip

>
>I just don't see this. I tried replacing X = BarNumber with X =
>CurrentBar and X = X + 1, but with the same results.
>
>Can anybody tell me what's going on or how to convert this function to
>simple?
>


The problem is with using X in the summation.

The following will not work as a simple function:

Vars: X(0);
X = BarNumber;
Value1 = Summation(X, 12);

because the Summation has to refer to past values of X.

The direct way is to incorporate the code for the summations and averages
directly in you code, making sure you never refer to past values by either
saving the values you need in an array, or better, accumulating the sums
you need bar by bar.

You don't say why use need it as a simple function. Maybe you could remove
that requirement somehow.

Bob Fulks