Class TechnicalIndicators

java.lang.Object
org.episteme.social.economics.analysis.TechnicalIndicators

public final class TechnicalIndicators extends Object
Technical Analysis Indicators for financial markets. Provides calculations for common market indicators used in algorithmic trading and market analysis.
Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Details

    • sma

      public static Real sma(List<FinancialMarketReader.Candle> candles, int period)
      Calculates the Simple Moving Average (SMA) of closing prices.
      Parameters:
      candles - Price data
      period - Number of periods for the average
      Returns:
      SMA value, or null if insufficient data
    • volatility

      public static Real volatility(List<FinancialMarketReader.Candle> candles, int period)
      Calculates the volatility (standard deviation of returns) over a period.
      Parameters:
      candles - Price data
      period - Number of periods
      Returns:
      Volatility as standard deviation, or null if insufficient data
    • rsi

      public static Real rsi(List<FinancialMarketReader.Candle> candles, int period)
      Calculates the Relative Strength Index (RSI). RSI invalid input: '<' 30 indicates oversold, RSI > 70 indicates overbought.
      Parameters:
      candles - Price data
      period - Number of periods (typically 14)
      Returns:
      RSI value (0-100), or null if insufficient data
    • bollingerBands

      public static Real[] bollingerBands(List<FinancialMarketReader.Candle> candles, int period, Real stdMultiplier)
      Calculates Bollinger Bands (upper, middle, lower).
      Parameters:
      candles - Price data
      period - SMA period (typically 20)
      stdMultiplier - Standard deviation multiplier (typically 2)
      Returns:
      Array of [lower, middle, upper] bands, or null if insufficient data
    • bollingerBands

      public static Real[] bollingerBands(List<FinancialMarketReader.Candle> candles, int period, double stdMultiplier)
    • percentChange

      public static Real percentChange(List<FinancialMarketReader.Candle> candles)
      Calculates the percentage change from the first to the last candle.
      Parameters:
      candles - Price data
      Returns:
      Percentage change, or null if insufficient data
    • isBelowSMA

      public static boolean isBelowSMA(List<FinancialMarketReader.Candle> candles, int smaPeriod, Real threshold)
      Detects if current price is significantly below SMA (bearish signal).
      Parameters:
      candles - Price data
      smaPeriod - SMA period
      threshold - Percentage below SMA to trigger (e.g., 0.05 = 5%)
      Returns:
      true if price is significantly below SMA
    • isBelowSMA

      public static boolean isBelowSMA(List<FinancialMarketReader.Candle> candles, int smaPeriod, double threshold)