Extend LeastSquaresMovingAverage to Accept a Benchmark
Expected Behavior
Lean supports LeastSquaresMovingAverage as a Lean Indicator which takes a Symbol object, a benchmark Symbol, and a look-back period.
Actual Behavior
The current implementation assumes a constant slope: LeastSquaresMovingAverage.cs#L59. See #83.
Potential Solution
Implement this indicator.
Checklist
- [x] I have completely filled out this template
- [x] I have confirmed that this issue exists on the current
masterbranch - [x] I have confirmed that this is not a duplicate issue by searching issues
- [x] I have provided detailed steps to reproduce the issue
Sorry if this is a redundant question, but how can I reproduce this issue? I do not see the information here in spite of the fourth box on the checklist being ticked.
Hi @pranavathreya , It's not a bug; it's a feature.
The goal is to implement this method:
public LeastSquaresMovingAverage LSMA(Symbol symbol, Symbol reference, int period,
Resolution? resolution = null, Func<IBaseData, decimal> selector = null)
{
// ...
}
see the new Symbol reference parameter which will be used by the LeastSquaresMovingAverage constructor:
var leastSquaresMovingAverage = new LeastSquaresMovingAverage(name, reference, period);
You can look for the A indicator for reference.
Hi @AlexCatarino, thank you so much for this context. Let me do some reading and get back to you.
I can implement this method. Could you please assign it to me?
Hi @pranavathreya, please follow the Docs on how to add indicators to LEAN.