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... | |
override void | Reset () |
Resets this indicator to its initial state More... | |
Public Attributes | |
override bool | IsReady => _targetDataPoints.Samples >= WarmUpPeriod && _referenceDataPoints.Samples >= WarmUpPeriod |
Gets a flag indicating when the indicator is ready and fully initialized More... | |
Protected Member Functions | |
override decimal | ComputeNextValue (IBaseDataBar input) |
Computes the next value for this indicator from the given state. More... | |
Protected Member Functions inherited from QuantConnect.Indicators.BarIndicator | |
BarIndicator (string name) | |
Creates a new TradeBarIndicator with the specified name More... | |
Properties | |
int | WarmUpPeriod [get] |
Required period, in data points, for the indicator to be ready and fully initialized. More... | |
Properties inherited from QuantConnect.Indicators.IIndicatorWarmUpPeriodProvider | |
int | WarmUpPeriod [get] |
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.
Definition at line 34 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 90 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 120 of file Correlation.cs.
|
protected |
Computes the next value for this indicator from the given state.
As this indicator is receiving data points from two different symbols, it's going to compute the next value when the amount of data points of each of them is the same. Otherwise, it will return the last correlation value computed
input | The input value of this indicator on this time step. It can be either from the target or the reference symbol |
Definition at line 136 of file Correlation.cs.
override void QuantConnect.Indicators.Correlation.Reset | ( | ) |
Resets this indicator to its initial state
Definition at line 185 of file Correlation.cs.
override bool QuantConnect.Indicators.Correlation.IsReady => _targetDataPoints.Samples >= WarmUpPeriod && _referenceDataPoints.Samples >= WarmUpPeriod |
Gets a flag indicating when the indicator is ready and fully initialized
Definition at line 79 of file Correlation.cs.
|
get |
Required period, in data points, for the indicator to be ready and fully initialized.
Definition at line 74 of file Correlation.cs.