Skip to content

feat: implement TD Sequential candlestick indicator (#6620)#9521

Open
ugur-murat-alt wants to merge 1 commit into
QuantConnect:masterfrom
ugur-murat-alt:feature/td-sequential-indicator
Open

feat: implement TD Sequential candlestick indicator (#6620)#9521
ugur-murat-alt wants to merge 1 commit into
QuantConnect:masterfrom
ugur-murat-alt:feature/td-sequential-indicator

Conversation

@ugur-murat-alt

Copy link
Copy Markdown

Description

Implements the Tom DeMark (TD) Sequential candlestick indicator as requested in issue #6620. This indicator identifies potential trend exhaustion points through two sequential phases: Setup (9 bars) and Countdown (13 bars).

Implementation Details

Indicators/TdSequential.cs

  • Extends WindowIndicator following existing Lean conventions
  • Implements the complete TD Sequential methodology:
    • Setup Phase: Counts 9 consecutive bars where close < close 4 bars ago (Buy) or close > close 4 bars ago (Sell)
    • Countdown Phase: After setup completion, counts 13 bars where close <= low 2 bars ago (Buy) or close >= high 2 bars ago (Sell)
    • Perfect Setups: Detects when bar 8 or 9 has extreme price levels relative to bars 6-7
    • Support/Resistance: Calculates and tracks price levels from completed setups
  • Exposes key properties:
    • SetupCount / CountdownCount - Current phase progress (1-9, 1-13)
    • IsSetupComplete / IsCountdownComplete - Boolean completion states
    • Signal - Directional trading signal (None/Buy/Sell)
    • SupportPrice / ResistancePrice - Critical thresholds for countdown validation

Tests/Indicators/TdSequentialTests.cs

  • Extends CommonIndicatorTests following test conventions
  • Covers: warmup period, reset, buy/sell setup detection, countdown phases, support/resistance calculation, countdown invalidation, signal properties, Renko bar compatibility

Algorithm.CSharp/TdSequentialExampleAlgorithm.cs

  • Demonstrates indicator usage in a trading algorithm with SPY
  • Shows setup completion trade signals and countdown monitoring

Verification

  • Build: 0 errors (both Indicators and Tests projects)
  • Logic: 41/41 standalone tests pass (test framework has environment-specific Python GIL dependency)
  • Pattern compliance: follows existing TomDemarkSequential and WindowIndicator patterns

Closes #6620

- Add TdSequential indicator implementing Tom DeMark Sequential methodology
- Supports Buy/Sell Setup (9 consecutive bars) and Countdown (13 bars) phases
- Exposes SetupCount, CountdownCount, IsSetupComplete, IsCountdownComplete, Signal
- Includes SupportPrice and ResistancePrice for countdown validation
- Detects perfect setups (bars 8/9 with extreme lows/highs relative to bars 6-7)
- Add comprehensive unit tests covering all phases and edge cases
- Add example algorithm demonstrating indicator usage with SPY
- Follows existing Lean codebase patterns for WindowIndicator<IBaseDataBar>
Copilot AI review requested due to automatic review settings June 11, 2026 09:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement TD Sequential Candlestick Indicator

2 participants