Lean  $LEAN_TAG$
QuantConnect.Indicators.Correlation Class Reference

The Correlation Indicator is a valuable tool in technical analysis, designed to quantify the degree of relationship between the price movements of a target security (e.g., a stock or ETF) and a reference market index. It measures how closely the target’s price changes are aligned with the fluctuations of the index over a specific period of time, providing insights into the target’s susceptibility to market movements. A positive correlation indicates that the target tends to move in the same direction as the market index, while a negative correlation suggests an inverse relationship. A correlation close to 0 implies a weak or no linear relationship. Commonly, the SPX index is employed as the benchmark for the overall market when calculating correlation, ensuring a consistent and reliable reference point. This helps traders and investors make informed decisions regarding the risk and behavior of the target security in relation to market trends. More...

Inheritance diagram for QuantConnect.Indicators.Correlation:
[legend]

Public Member Functions

 Correlation (string name, Symbol targetSymbol, Symbol referenceSymbol, int period, CorrelationType correlationType=CorrelationType.Pearson)
 Creates a new Correlation indicator with the specified name, target, reference, and period values More...
 
 Correlation (Symbol targetSymbol, Symbol referenceSymbol, int period, CorrelationType correlationType=CorrelationType.Pearson)
 Creates a new Correlation indicator with the specified target, reference, and period values More...
 

Public Attributes

override bool IsReady => TargetDataPoints.IsReady && ReferenceDataPoints.IsReady
 Gets a flag indicating when the indicator is ready and fully initialized More...
 

Protected Member Functions

override decimal ComputeIndicator ()
 Computes the correlation value usuing symbols values correlation values assing into _correlation property More...
 
- Protected Member Functions inherited from QuantConnect.Indicators.DualSymbolIndicator< IBaseDataBar >
 DualSymbolIndicator (string name, Symbol targetSymbol, Symbol referenceSymbol, int period)
 Initializes the dual symbol indicator. More...
 

Additional Inherited Members

- Properties inherited from QuantConnect.Indicators.DualSymbolIndicator< IBaseDataBar >
IReadOnlyWindow< TInput > TargetDataPoints [get]
 RollingWindow to store the data points of the target symbol More...
 
IReadOnlyWindow< TInput > ReferenceDataPoints [get]
 RollingWindow to store the data points of the reference symbol More...
 
Symbol ReferenceSymbol [get]
 Symbol of the reference used More...
 
Symbol TargetSymbol [get]
 Symbol of the target used More...
 

Detailed Description

The Correlation Indicator is a valuable tool in technical analysis, designed to quantify the degree of relationship between the price movements of a target security (e.g., a stock or ETF) and a reference market index. It measures how closely the target’s price changes are aligned with the fluctuations of the index over a specific period of time, providing insights into the target’s susceptibility to market movements. A positive correlation indicates that the target tends to move in the same direction as the market index, while a negative correlation suggests an inverse relationship. A correlation close to 0 implies a weak or no linear relationship. Commonly, the SPX index is employed as the benchmark for the overall market when calculating correlation, ensuring a consistent and reliable reference point. This helps traders and investors make informed decisions regarding the risk and behavior of the target security in relation to market trends.

The indicator only updates when both assets have a price for a time step. When a bar is missing for one of the assets, the indicator value fills forward to improve the accuracy of the indicator.

Definition at line 39 of file Correlation.cs.

Constructor & Destructor Documentation

◆ Correlation() [1/2]

QuantConnect.Indicators.Correlation.Correlation ( string  name,
Symbol  targetSymbol,
Symbol  referenceSymbol,
int  period,
CorrelationType  correlationType = CorrelationType.Pearson 
)

Creates a new Correlation indicator with the specified name, target, reference, and period values

Parameters
nameThe name of this indicator
targetSymbolThe target symbol of this indicator
periodThe period of this indicator
referenceSymbolThe reference symbol of this indicator
correlationTypeCorrelation type

Definition at line 60 of file Correlation.cs.

◆ Correlation() [2/2]

QuantConnect.Indicators.Correlation.Correlation ( Symbol  targetSymbol,
Symbol  referenceSymbol,
int  period,
CorrelationType  correlationType = CorrelationType.Pearson 
)

Creates a new Correlation indicator with the specified target, reference, and period values

Parameters
targetSymbolThe target symbol of this indicator
periodThe period of this indicator
referenceSymbolThe reference symbol of this indicator
correlationTypeCorrelation type

Definition at line 79 of file Correlation.cs.

Member Function Documentation

◆ ComputeIndicator()

override decimal QuantConnect.Indicators.Correlation.ComputeIndicator ( )
protected

Computes the correlation value usuing symbols values correlation values assing into _correlation property

Definition at line 88 of file Correlation.cs.

Here is the call graph for this function:

Member Data Documentation

◆ IsReady

override bool QuantConnect.Indicators.Correlation.IsReady => TargetDataPoints.IsReady && ReferenceDataPoints.IsReady

Gets a flag indicating when the indicator is ready and fully initialized

Definition at line 49 of file Correlation.cs.


The documentation for this class was generated from the following file: