Add B10 Ehlers / Cycle deepening (10 indicators) (#199)

Deepens the **Ehlers / Cycle (DSP)** family (B10) with ten indicators (452 -> 462):

- **HighpassFilter**, **Reflex**, **Trendflex**, **CorrelationTrendIndicator**, **AdaptiveRsi**, **UniversalOscillator** — scalar (f64) Ehlers filters/oscillators.
- **AdaptiveCci** — efficiency-ratio-adaptive CCI on typical price (Candle input).
- **BandpassFilter**, **EvenBetterSinewave**, **AutocorrelationPeriodogram** — multi-arg scalar (hand-written bindings; the wasm variadic scalar macro covers wasm).

Verified locally: 3755 core lib + 420 doc tests, clippy clean, 537 node tests, 881 pytest, counter 462.
This commit is contained in:
kingchenc
2026-06-07 04:25:16 +02:00
committed by GitHub
parent 707f29e8e4
commit 80850c81f7
25 changed files with 3603 additions and 71 deletions
+47
View File
@@ -2591,6 +2591,44 @@ impl WasmTimeBasedStop {
}
}
#[wasm_bindgen(js_name = ADAPTIVECCI)]
pub struct WasmAdaptiveCci {
inner: wc::AdaptiveCci,
}
#[wasm_bindgen(js_class = ADAPTIVECCI)]
impl WasmAdaptiveCci {
#[wasm_bindgen(constructor)]
pub fn new(period: usize) -> Result<WasmAdaptiveCci, JsError> {
Ok(Self {
inner: wc::AdaptiveCci::new(period).map_err(map_err)?,
})
}
pub fn update(&mut self, high: f64, low: f64, close: f64) -> Result<Option<f64>, JsError> {
let c = make_candle(high, low, close, 0.0)?;
Ok(self.inner.update(c))
}
pub fn batch(
&mut self,
high: &[f64],
low: &[f64],
close: &[f64],
) -> Result<Float64Array, JsError> {
if high.len() != low.len() || low.len() != close.len() {
return Err(JsError::new("high, low, close must be equal length"));
}
let mut out = Vec::with_capacity(high.len());
for i in 0..high.len() {
let c = make_candle(high[i], low[i], close[i], 0.0)?;
out.push(self.inner.update(c).unwrap_or(f64::NAN));
}
Ok(Float64Array::from(out.as_slice()))
}
pub fn reset(&mut self) {
self.inner.reset();
}
}
#[wasm_bindgen(js_name = Stochastic)]
pub struct WasmStoch {
inner: wc::Stochastic,
@@ -11261,6 +11299,15 @@ wasm_scalar_indicator!(WasmJarqueBera, "JARQUEBERA", wc::JarqueBera, period: usi
wasm_scalar_indicator!(WasmRollingMinMaxScaler, "ROLLINGMINMAX", wc::RollingMinMaxScaler, period: usize);
wasm_scalar_indicator!(WasmShannonEntropy, "SHANNONENT", wc::ShannonEntropy, period: usize, bins: usize);
wasm_scalar_indicator!(WasmSampleEntropy, "SAMPLEENT", wc::SampleEntropy, period: usize, m: usize, r_factor: f64);
wasm_scalar_indicator!(WasmHighpassFilter, "HIGHPASS", wc::HighpassFilter, period: usize);
wasm_scalar_indicator!(WasmReflex, "REFLEX", wc::Reflex, period: usize);
wasm_scalar_indicator!(WasmTrendflex, "TRENDFLEX", wc::Trendflex, period: usize);
wasm_scalar_indicator!(WasmCorrelationTrendIndicator, "CTI", wc::CorrelationTrendIndicator, period: usize);
wasm_scalar_indicator!(WasmAdaptiveRsi, "ADAPTIVERSI", wc::AdaptiveRsi, period: usize);
wasm_scalar_indicator!(WasmUniversalOscillator, "UNIVERSALOSC", wc::UniversalOscillator, period: usize);
wasm_scalar_indicator!(WasmBandpassFilter, "BANDPASS", wc::BandpassFilter, period: usize, bandwidth: f64);
wasm_scalar_indicator!(WasmEvenBetterSinewave, "EVENBETTERSINE", wc::EvenBetterSinewave, hp_period: usize, ssf_length: usize);
wasm_scalar_indicator!(WasmAutocorrelationPeriodogram, "AUTOCORRPGRAM", wc::AutocorrelationPeriodogram, min_period: usize, max_period: usize);
// --- VolatilityCone: Candle in, struct out (current/min/median/max/percentile) ---