Alpha freezes when target/reference sample counts diverge

Open
#9,936 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #9947 by @abhi-byte62 — closed without merging

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
data

Research direction

Start with Indicators/Alpha.cs and trace how target and reference ROC observations are counted and used to decide when Alpha recalculates. Reproduce the issue with periods 2/4 by feeding two benchmark-only daily bars followed by at least five timestamp-matched stock and benchmark pairs. Done means Alpha recalculates from aligned return windows without requiring equal lifetime sample counts, and no longer remains zero or stale.

Written by the indexing model from the issue text.

Description

Expected Behavior

Alpha indicator should not produce only 0s.

Actual Behavior

Alpha indicator produces only 0s.
Indicators/Alpha.cs only recalculates Alpha when:
_targetROC.Samples == _referenceROC.Samples
Different IPO dates, missing bars or different trading calendars can permanently offset these counters. Alpha then remains zero or stale, even when IsReady is true.

Potential Solution

Expected: Synchronize observations by timestamp and calculate from aligned return windows, without requiring equal lifetime sample counts.

Reproducing the Problem

Reproduction: Create Alpha with periods 2/4. Feed two benchmark-only daily bars, then at least five timestamp-matched stock/benchmark pairs. Alpha never recalculates because the counters remain unequal.

System Information

windows

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
Dominant language
C#
Stars
22.6k
Forks
5.4k
Avg merge
11h 39m
Merged PRs (30d)
104

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from QuantConnect/Lean

All issues in QuantConnect/Lean

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.