Correlation Coefficient

Correlation coefficient is an important statistical indicator in quantitative trading used to measure the strength and direction of linear relationship between two time series.

Calculation Principle

Correlation coefficient is calculated using the following formula:

r = Cov(X,Y) / (σ_x × σ_y)

Where:

  • Cov(X,Y): Covariance of X and Y
  • σ_x: Standard deviation of X
  • σ_y: Standard deviation of Y

Parameter Description

  • Input Parameters: Two K-line data series
  • timeperiod: Calculation period, default 30
  • Output: Correlation coefficient value (range: -1 to 1)

Usage Recommendations

  1. Adjust calculation period according to actual needs
  2. Pay attention to data time span
  3. Consider data frequency
  4. Pay attention to data alignment
  5. Recalculate periodically
  6. Pay attention to result interpretation

Notes

  • Ensure data quality
  • Pay attention to data preprocessing
  • Consider the impact of extreme values
  • Pay attention to the impact of calculation period
  • Consider data stationarity
  • Pay attention to result stability
  • Consider the impact of sample size
Last Updated: