Interface CacheableRTIndicator

All Superinterfaces:
Resettable, RTIndicator
All Known Implementing Classes:
AcceleratorOscillatorRTIndicator, AdlRTIndicator, AdxRTIndicator, AroonRTIndicator, AtrRTIndicator, AwesomeOscillatorRTIndicator, BalanceOfPowerRTIndicator, BullBearPowerRTIndicator, ChaikinOscillatorRTIndicator, ChandeKrollStopRTIndicator, ChandelierExitRTIndicator, ChoppinessIndexRTIndicator, CmfRTIndicator, CompoundTickerRTIndicator, DonchianChannelRTIndicator, EaseOfMovementRTIndicator, ElderForceIndexRTIndicator, EmaRTIndicator, IchimokuRTIndicator, KeltnerChannelRTIndicator, KlingerOscillatorRTIndicator, MassIndexRTIndicator, MfiRTIndicator, MmaRTIndicator, NatrRTIndicator, NegativeVolumeIndexRTIndicator, ObvRTIndicator, ParabolicSarRTIndicator, PvtRTIndicator, RelativeVigorIndexRTIndicator, RsiRTIndicator, SmaRTIndicator, SmmaRTIndicator, StochasticOscillatorRTIndicator, SuperTrendRTIndicator, TickerRTIndicator, UltimateOscillatorRTIndicator, VortexRTIndicator, VwapRTIndicator, WilliamsRRTIndicator

public interface CacheableRTIndicator extends RTIndicator
Opt-in contract for an indicator that can state its own math identity, so a series it produced over one dataset can be replayed instead of recomputed.

The contract is deliberately narrow and opt-in. An indicator that does not implement this interface computes live and poisons its downstream chain — always correct, merely unmemoized — so partial coverage of the catalog is the design rather than a shortfall.

What a signature has to capture

Everything that can change the value series for a given input stream, taken from the instance and never from the name it was registered under. The registration name is not an identity: a swept property changes the instance while the name stays constant, so a name-derived key would hand ema(12) the series recorded for ema(10). That includes:

  • every field that enters the arithmetic — periods, smoothing factors, mode flags set after construction such as SmaRTIndicator.withDiscreteMode;
  • the signature of the source indicator it decorates, recursively, via sourceTag(RTIndicator). A source that cannot state its own identity makes this indicator unidentifiable too, which is why sourceTag returns null for it.

A signature that forgets one of those is not caught by the type system. It is caught by the mandatory golden run the sweep layer performs — one vector executed twice, live and replayed, with the trade lists compared — which disables the memoization for the rest of the sweep when they differ. That guard is the only thing standing between a forgotten field and a silently wrong leaderboard.

The signature is read once, when the indicator is registered. Reconfiguring an indicator after registration would leave a stale identity behind; register it configured.

  • Method Details

    • signature

      String signature()
      This instance's math identity — equal signatures must mean identical value series for identical input.
      Returns:
      the identity, or null when this instance cannot state one (an unidentifiable source, a mode the implementation does not model) and must therefore compute live
    • signatureOf

      static Optional<String> signatureOf(RTIndicator indicator)
      The signature of an indicator reference, seeing through a read-only view.

      Views are what getReadOnlyExisting hands to every derived indicator, so without the unwrap no decorated indicator would ever be identifiable.

      Parameters:
      indicator - the reference to identify, may be null
      Returns:
      its signature, or empty when it has none
    • sourceTag

      static String sourceTag(RTIndicator source)
      The source-chain fragment to append to a decorating indicator's own signature.

      Three outcomes, and the middle one is the point: no source at all is identifiable (the empty string), an identifiable source contributes its signature, and an unidentifiable source makes the whole chain unidentifiable — null, which the caller returns as its own signature to opt out.

      Parameters:
      source - the decorated indicator, or null when this indicator reads the raw stream
      Returns:
      the fragment to append, or null when the source cannot be identified
    • leafSignature

      static String leafSignature(RTIndicator self, Class<?> exactClass, String params)
      The identity of an indicator that reads the raw stream rather than decorating another one, which is the shape of the whole OHLCV suite.

      It exists to make the two mistakes of hand-writing a few dozen near-identical identities harmless. The class-exact check lives here, so an implementation cannot forget it. And the name is derived rather than written, so the copy-paste that would otherwise be the dangerous one — carrying a neighbour's literal prefix into a class whose arithmetic differs — cannot happen. Copying a whole body instead leaves the neighbour's class literal in place, and the class-exact check turns that into a denial: slower, never wrong.

      The name is the class's own, minus the package root every indicator shares and minus the RTIndicator suffix, which makes it unique by the same rule that makes class names unique. A bare simple name would not be: three names already exist in both the base and the pro catalog with different arithmetic behind them.

      Parameters:
      self - the indicator stating its identity, always this
      exactClass - the class that owns this identity, always a class literal of the caller
      params - everything entering the arithmetic, in the k=v,k=v form the base catalog uses; empty for an indicator with no parameters at all
      Returns:
      the identity, or null when self is a subclass and so must state its own