Skip to main content

get_indicator_value

Function get_indicator_value 

Source
pub fn get_indicator_value(
    indicators: &TechnicalIndicators,
    name: &str,
    params: &[f64],
) -> Option<f64>
Expand description

Extract an indicator value from TechnicalIndicators by name and params.

Mapping rules:

  • “RSI” → rsi_14
  • “MACD” → macd_line; “MACD_signal” → macd_signal; “MACD_histogram” → macd_histogram
  • “SMA” with param 20 → sma_20, param 50 → sma_50
  • “EMA” with param 12 → ema_12, param 26 → ema_26
  • “BB_upper” → bb_upper; “BB_middle” → bb_middle; “BB_lower” → bb_lower
  • “ADX” → adx_14
  • “ATR” → atr_14
  • “STOCH_K” → stoch_k; “STOCH_D” → stoch_d
  • “CCI” → cci_20
  • “WILLIAMS_R” → williams_r_14
  • “OBV” → obv
  • “MFI” → mfi_14