door GM » ma 17 maart 2003, 15:44
{*******************************************************************
Description: This Function returns coeffR
Provided By: Omega Research, Inc. (c) Copyright 1999
********************************************************************}
Inputs: Length(Numeric);
Variables: R(0), X(0), Y(0), UpEQ(0), LowEQ1(0), LowEQ2(0), LowEQT(0);
X = CurrentBar;
Y = Close;
UpEQ = Summation(X * Y, Length) - Length * Average(X, Length) * Average(Y, Length);
LowEQ1 = Summation(Square(X), Length) - Length * Square(Average(X, Length));
LowEQ2 = Summation(Square(Y), Length) - Length * Square(Average(Y, Length));
If LowEQ1 * LowEQ2 > 0 Then
LowEQT = SquareRoot(LowEQ1 * LowEQ2);
If LowEQT <> 0 ?Then Begin
R = UpEQ / LowEQT;
If R <= 1 AND R >= -1 Then
coeffR = R;
End;