Class BollingerBandsRTIndicator

java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.bollinger.BollingerBandsRTIndicator
All Implemented Interfaces:
Resettable, RTIndicator

public class BollingerBandsRTIndicator extends AbstractRTIndicator
Bollinger bands RTIndicator
See Also:
  • Field Details

    • ID

      public static final String ID
      Canonical catalog id, set as an explicit IndicatorMeta.ID override where getId() class-name derivation would be wrong.
      See Also:
  • Constructor Details

    • BollingerBandsRTIndicator

      public BollingerBandsRTIndicator()
    • BollingerBandsRTIndicator

      public BollingerBandsRTIndicator(int periods, Number k)
    • BollingerBandsRTIndicator

      public BollingerBandsRTIndicator(RTIndicator indicator, int periods, Number k)
  • Method Details

    • isReady

      public boolean isReady()
      Description copied from interface: RTIndicator
      Returns whether this indicator has received enough data to produce meaningful values.

      During the warmup period, RTIndicator.getValue() may return 0 or a partial estimate that should not be used for trading decisions. Once this method returns true, the indicator's output is statistically valid.

      The default implementation returns true for backward compatibility. Indicators with warmup requirements should override this method.

      For composite indicators (e.g. Bollinger Bands, MACD), readiness is determined by the slowest internal component.

      Returns:
      true if the indicator has completed its warmup period
    • reset

      public void reset()
      Specified by:
      reset in interface Resettable
      Overrides:
      reset in class AbstractRTIndicator
    • withAverageSample

      public BollingerBandsRTIndicator withAverageSample(boolean averageSample)
    • getStdDev

      public RTIndicator getStdDev()
    • getUpper

      public RTIndicator getUpper()
    • getLower

      public RTIndicator getLower()
    • getBandWidth

      public BollingerBandWidthRTIndicator getBandWidth()
    • update

      public double update(double newValue)
      Computes the Bollinger Bands for a new value. The middle band is the SMA (retrieved from the variance's internal SMA). Upper and lower bands are computed as middle +/- (k * standard deviation). All three bands are updated atomically on each call.
      Specified by:
      update in interface RTIndicator
      Overrides:
      update in class AbstractRTIndicator
      Parameters:
      newValue - the new input price
      Returns:
      the middle band value (SMA)