Lean
Lean copied to clipboard
Add remove/unregister indicator algorithm helper method
Expected Behavior
The RsiAlphaModel creates manual indicators, since we can't assume the universe is fixed.
Actual Behavior
The RsiAlphaModel creates automatic indicators.
Potential Solution
Update the RsiAlphaModel to use manual indicators (use the RelativeStrengthIndicator constructor)
Reproducing the Problem
View the RsiAlphaModel source code https://github.com/QuantConnect/Lean/blob/aaba566954e995053eb97656b05e06a3984fc9fb/Algorithm.Framework/Alphas/RsiAlphaModel.py#L84
System Information
N/A
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
Transforming this issue into a more generic missing feature/bug: indicators created through the helper methods at QCAlgorithm.Indicators.cs do not have an equivalent helper method to remove/unregister these indicators
- At the indicator's creation time, save a reference to the consolidator in the indicator base class.
- Create UnregisterIndicator and use its reference to the consolidator to unsubscribe it from events.
See related https://github.com/QuantConnect/Lean/issues/7092 https://github.com/QuantConnect/Lean/issues/7089, potential consumers of the new method to add