Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Add remove/unregister indicator algorithm helper method

Open DerekMelchin opened this issue 3 years ago • 1 comments

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 master branch
  • [x] I have confirmed that this is not a duplicate issue by searching issues
  • [x] I have provided detailed steps to reproduce the issue

DerekMelchin avatar May 12 '22 18:05 DerekMelchin

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

Martin-Molinero avatar May 12 '22 19:05 Martin-Molinero

  • 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.

jaredbroad avatar Feb 20 '23 15:02 jaredbroad

See related https://github.com/QuantConnect/Lean/issues/7092 https://github.com/QuantConnect/Lean/issues/7089, potential consumers of the new method to add

Martin-Molinero avatar May 22 '23 15:05 Martin-Molinero