Lean
$LEAN_TAG$
|
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...
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 Member Functions inherited from QuantConnect.Indicators.DualSymbolIndicator< double > | |
override void | Reset () |
Resets this indicator to its initial state 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 void | AddDataPoint (IBaseDataBar input) |
Adds the closing price to the target or reference symbol's data set. More... | |
override void | ComputeIndicator () |
Computes the correlation value usuing symbols values correlation values assing into _correlation property More... | |
Protected Member Functions inherited from QuantConnect.Indicators.DualSymbolIndicator< double > | |
DualSymbolIndicator (string name, Symbol targetSymbol, Symbol referenceSymbol, int period) | |
Initializes the dual symbol indicator. More... | |
override decimal | ComputeNextValue (IBaseDataBar input) |
Checks and computes the indicator if the input data matches. This method ensures the input data points are from matching time periods and different symbols. More... | |
abstract void | AddDataPoint (IBaseDataBar input) |
Adds the closing price to the corresponding symbol's data set (target or reference). This method stores the data points for each symbol and performs specific calculations based on the symbol. For instance, it computes returns in the case of the Beta indicator. More... | |
Additional Inherited Members | |
Properties inherited from QuantConnect.Indicators.DualSymbolIndicator< double > | |
RollingWindow< T > | TargetDataPoints [get] |
RollingWindow to store the data points of the target symbol More... | |
RollingWindow< T > | 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... | |
bool | IsTimezoneDifferent [get] |
Indicates if the time zone for the target and reference are different. More... | |
decimal | IndicatorValue [get, set] |
The most recently computed value of the indicator. More... | |
int | WarmUpPeriod [get, set] |
Required period, in data points, for the indicator to be ready and fully initialized. More... | |
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 37 of file Correlation.cs.
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
name | The name of this indicator |
targetSymbol | The target symbol of this indicator |
period | The period of this indicator |
referenceSymbol | The reference symbol of this indicator |
correlationType | Correlation type |
Definition at line 58 of file Correlation.cs.
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
targetSymbol | The target symbol of this indicator |
period | The period of this indicator |
referenceSymbol | The reference symbol of this indicator |
correlationType | Correlation type |
Definition at line 78 of file Correlation.cs.
|
protected |
Adds the closing price to the target or reference symbol's data set.
input | The input value for this symbol |
ArgumentException | Thrown if the input symbol is not the target or reference symbol. |
Definition at line 88 of file Correlation.cs.
|
protectedvirtual |
Computes the correlation value usuing symbols values correlation values assing into _correlation property
Implements QuantConnect.Indicators.DualSymbolIndicator< double >.
Definition at line 108 of file Correlation.cs.
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 47 of file Correlation.cs.