Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Update LinearWeightedMovingAverage.cs

Open mr-september opened this issue 1 year ago • 2 comments

Fix off by one indexing error in denominator, and calculation error in numerator.

Description

Related Issue

Motivation and Context

Requires Documentation Change

How Has This Been Tested?

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] Refactor (non-breaking change which improves implementation)
  • [ ] Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Non-functional change (xml comments/documentation/etc)

Checklist:

  • [ ] My code follows the code style of this project.
  • [ ] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.
  • [ ] My branch follows the naming convention bug-<issue#>-<description> or feature-<issue#>-<description>

mr-september avatar Feb 08 '24 14:02 mr-september

Hey @mr-september! Welcome to Lean Please share some information about the issue, error/how to reproduce? We should add some unit test reproducing the issue so we can assert it's nature and how to and if it's been fixed 👍

Martin-Molinero avatar Feb 08 '24 18:02 Martin-Molinero

Hey @mr-september! Welcome to Lean Please share some information about the issue, error/how to reproduce? We should add some unit test reproducing the issue so we can assert it's nature and how to and if it's been fixed 👍

Hi, my apologies, I am not an experienced developer, especially not with C#. I have merely noticed inconsistent behaviour while porting strategies from another platform to QuantConnect, and after some attempts to investigate, I believe this may be the root of the issue.

It is not a technical error, but a mathematical/logical one. It may be best to have someone more experienced review this indicator's implementation.

mr-september avatar Feb 11 '24 04:02 mr-september

Thank you @mr-september, we've revised the current implementation and believe it's correct, we've added more tests comparing the expected values with 3rd party.

Marinovsky avatar Feb 20 '24 15:02 Marinovsky