Same Value for Correlation Indicator for Pearson and Spearman
Closed this issue · 1 comments
superichmann commented
Expected Behavior
When initializing Correlation indicator with CorrelationType.Pearson
the output value of the indicator should be different then when initializing it with CorrelationType.Spearman
Actual Behavior
The same value is outputted by the indicator (Pearson I guess).
Potential Solution
Actually do really yes implement both of the correlation type or remove this option completely.
Reproducing the Problem
namespace QuantConnect.Algorithm.CSharp
{
public class corrnogood : QCAlgorithm
{
Correlation cp;
Correlation cs;
public override void Initialize()
{
SetStartDate(2023, 1, 1);
var symbol=AddEquity("AAPL", Resolution.Daily).Symbol;
var spy=AddEquity("SPY", Resolution.Daily).Symbol;
cp=C(symbol, spy, 5, CorrelationType.Pearson);
cs=C(symbol, spy, 5, CorrelationType.Spearman);
cp.Window.Size=1000;
cs.Window.Size=1000;
}
public override void OnData(Slice data)
{
if (data.Bars.ContainsKey("AAPL"))
{
if (cp.IsReady)
{
Plot("PLOTPLZ","cp",cp);
Plot("PLOTPLZ","cs",cs);
}
}
}
}
}
System Information
qc cloud
Checklist
- I have completely filled out this template
- I have confirmed that this issue exists on the current
master
branch - I have confirmed that this is not a duplicate issue by searching issues
- I have provided detailed steps to reproduce the issue
Martin-Molinero commented
Thank you for the report @superichmann, seems there's a typo and we are missing to pass through the correlation type, we will fix it asap