Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.Exception: Attempted to divide by zero. in LogReturn indicator #7782

Closed
4 tasks
superichmann opened this issue Feb 14, 2024 · 0 comments · Fixed by #7788
Closed
4 tasks

System.Exception: Attempted to divide by zero. in LogReturn indicator #7782

superichmann opened this issue Feb 14, 2024 · 0 comments · Fixed by #7788
Assignees
Labels

Comments

@superichmann
Copy link

 System.Exception: Attempted to divide by zero. in LogReturn.cs:line 60
 ---> QuantConnect.Exceptions.SystemExceptionInterpreter+SanitizedException: Attempted to divide by zero.
   at System.Decimal.DecCalc.VarDecDiv(DecCalc& d1, DecCalc& d2)
   at QuantConnect.Indicators.LogReturn.ComputeNextValue(IReadOnlyWindow`1 window, IndicatorDataPoint input) in Indicators\LogReturn.cs:line 60
   at QuantConnect.Indicators.IndicatorBase`1.ValidateAndComputeNextValue(T input) in Indicators\IndicatorBase.cs:line 340
   at QuantConnect.Indicators.IndicatorBase`1.Update(IBaseData input) in Indicators\IndicatorBase.cs:line 259
   at QuantConnect.Algorithm.QCAlgorithm.<>c__DisplayClass580_0.<RegisterIndicator>b__1(Object sender, IBaseData consolidated) in Algorithm\QCAlgorithm.Indicators.cs:line 2428
   at QuantConnect.Data.Consolidators.DataConsolidator`1.OnDataConsolidated(IBaseData consolidated) in Common\Data\Consolidators\DataConsolidator.cs:line 109
   at QuantConnect.Data.Consolidators.IdentityDataConsolidator`1.Update(T data) in Common\Data\Consolidators\IdentityDataConsolidator.cs:line 60
   at QuantConnect.Lean.Engine.AlgorithmManager.Run(AlgorithmNodePacket job, IAlgorithm algorithm, ISynchronizer synchronizer, ITransactionHandler transactions, IResultHandler results, IRealTimeHandler realtime, ILeanManager leanManager, CancellationToken token) in Engine\AlgorithmManager.cs:line 600

Maybe on this opportunity check all of the indicators for this bug? this is the third case I am opening in the past month for indicator bugs.

Expected Behavior

the strategy should continue running and not crash

Actual Behavior

the strategy crash

Potential Solution

make it so not crash

Reproducing the Problem

:{

System Information

windows 10 .NET 6

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants