|
Description |
This formula calculates the correlation coefficient R, which is a measurement of the linear relationship between two variables. |
|
|
Formula |
coeffR(instrument, Length, targetBar)=begin R=0 X=0 Y=0 UpEQ=0 LowEQ1=0 LowEQ2=0 LowEQT=0 UpEQ = Summation(instrument, BATE_INDEXxCLOSE, Length, targetBar) - Length * AveragePrice(instrument, BATE_BARINDEX, Length, targetBar) * AveragePrice(instrument, BATE_CLOSE, Length, targetBar) LowEQ1 = Summation(instrument, BATE_BARINDEX_SQUARED, Length, targetBar) - Length * (AveragePrice(instrument, BATE_BARINDEX, Length, targetBar)^2) LowEQ2 = Summation(instrument, BATE_CLOSE_SQUARED, Length, targetBar) - Length * (AveragePrice(instrument, BATE_CLOSE, Length, targetBar)^2) if (LowEQ1 * LowEQ2) > 0 then begin LowEQT = Sqrt(LowEQ1 * LowEQ2) end if LowEQT != 0 then begin R = UpEQ / LowEQT end R end |
|
|
Parameters |
instrument An instrument.
Length This study calculates several averages. The Length parameter is the number of periods, or bars, you want to average. There is no default value.
targetBar The bar, as oriented with the current bar, you want to analyze. |
|
|
Return Value |
The correlation coefficient R |
|
|
Examples |
RSquared_1(instrument, Length, targetBar)=begin RSquared = coeffR(instrument, Length, targetBar) ^ 2 end |
|
|
Comments |
NA |
©2008 Aspen Research Group, Ltd. All rights reserved. Terms of Use.