Automatic warm-up for registered indicators, scalar Update error and not-ready Current warning - #9670
Draft
jhonabreul wants to merge 2 commits into
Draft
Conversation
…-ready Current warning - Settings.AutomaticIndicatorWarmUp now also covers indicators registered through RegisterIndicator, including consolidator registrations: history is replayed through a temporary consolidator mirroring the registered one (same input type and period), removing the manual history-replay idiom. Consolidators expose their period through a new ConsolidatorBase.Period virtual; non time-based consolidators are skipped with a one-time debug message. Internal helper registrations go through RegisterIndicatorCore and keep handling warm-up themselves, unchanged. - IndicatorBase.Update(double) turns the common scalar-update misuse, e.g. 'indicator.update(bar.close)' from Python, into a prescriptive NotSupportedException naming the valid update forms. A decimal overload is not viable: it makes existing Update(IndicatorDataPoint) call sites ambiguous through the data point's implicit decimal conversion. - Reading IndicatorBase.Current while not ready logs a warning once per indicator naming samples received vs required. Internal reads from other indicators' updates are suppressed through a thread-static update scope, and the check self-disables once the indicator is ready so the hot path stays a single boolean check.
jhonabreul
force-pushed
the
feature-indicator-warmup-automation
branch
from
August 12, 2026 22:16
c6c51f4 to
e4fecde
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Indicator warm-up automation improvements, closing the gaps that force algorithms into manual history-replay ceremony:
Settings.AutomaticIndicatorWarmUpnow also coversRegisterIndicator, including consolidator registrations:ConsolidatorBase.Periodvirtual, implemented by the time-based consolidators.WarmUpPeriodare skipped silently.RegisterIndicatorCore, so their warm-up behavior is unchanged.indicator.update(bar.close)— the common scalar-update misuse from Python — now throws a prescriptiveNotSupportedExceptionnaming the valid update forms, instead of a cryptic binding error. (Adecimaloverload is not viable: it makes existingUpdate(IndicatorDataPoint)call sites ambiguous.)indicator.Currentwhile!IsReadylogs a one-time warning naming samples received vs needed. Internal reads by composite indicators (e.g. MACD reading its EMAs) are suppressed, and the check self-disables once ready.Behavioral notes:
AutomaticIndicatorWarmUpdefault staysfalse; flipping it is a separate policy decision.MarketHourAwareConsolidator.Periodchanged fromprotected TimeSpantopublic override TimeSpan?.Deferred: a per-call
register_indicator(..., warm_up=True)flag and a generalized warm-up helper (existingWarmUpIndicatoroverloads already cover the indicator case).Related Issue
N/A
Motivation and Context
Manual warm-up ceremony is a large source of boilerplate (~10–35 lines per algorithm), and manual replay is a recurring crash class (
self.history[TradeBar](forex_pair, ...)on quote-only forex;rsi.update(bar.close)binding errors). Makingregister_indicatorrespect the existing setting deletes the idiom instead of documenting it.Requires Documentation Change
Yes:
Settings.AutomaticIndicatorWarmUpnow also coversRegisterIndicator-registered indicators; the indicatorUpdatedocs can mention the scalar-update error.How Has This Been Tested?
AlgorithmIndicatorsTestscases (red before, green after): consolidator registration warms iff the setting is on; selector and resolution overloads; Renko skipped without throwing; forex indicators warm from quote data.IndicatorTestscases: prescriptive scalar-update error for data-point and bar indicators, including through the real Python binding; not-readyCurrentwarning fires once, not when ready, and not for internal composite reads.AutomaticIndicatorWarmupConsolidatorRegressionAlgorithm(C# + Python): green with identical statistics. Existing warm-up regression algorithms updated and green.Tests.Algorithm(12,715),Tests.Indicators(1,493),Tests.Python(1,323), all consolidator fixtures (234) — 0 failures.Types of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>