1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! # indicators — Technical Indicators + Market Regime Detection
//!
//! Unified crate combining:
//! - **Signal layers** (ported from `indicators.py`): VWAP, EMA, ML SuperTrend, Trend Speed,
//! Liquidity Profile, Confluence Engine, Market Structure, CVD, AO, Hurst, Price Acceleration.
//! - **Regime detection**: Indicator-based, HMM, and Ensemble detectors.
//! - **Standalone batch functions**: `ema()`, `sma()`, `atr()`, `rsi()`, `macd()`.
//!
//! ## Quick start — signal engine
//! ```rust,ignore
//! use indicators::{Indicators, ConfluenceEngine, LiquidityProfile, MarketStructure,
//! CVDTracker, VolatilityPercentile, SignalStreak, compute_signal,
//! settings::BotSettings};
//!
//! let s = BotSettings::btc();
//! let mut ind = Indicators::new(&s);
//! let mut liq = LiquidityProfile::new(s.liq_period, s.liq_bins);
//! let mut conf = ConfluenceEngine::new(s.conf_ema_fast, s.conf_ema_slow,
//! s.conf_ema_trend, s.conf_rsi_len, s.conf_adx_len);
//! let mut ms = MarketStructure::new(s.struct_swing_len, s.struct_atr_mult);
//! let mut cvd = CVDTracker::new(s.cvd_slope_bars, s.cvd_div_lookback);
//! let mut vol = VolatilityPercentile::new(200);
//! let mut streak = SignalStreak::new(s.signal_confirm_bars);
//!
//! // per-candle update
//! ind.update(&candle);
//! liq.update(&candle);
//! conf.update(&candle);
//! ms.update(&candle);
//! cvd.update(&candle);
//! vol.update(ind.atr);
//! let (raw, _) = compute_signal(candle.close, &ind, &liq, &conf, &ms, &s, Some(&cvd), Some(&vol));
//! if streak.update(raw) { /* confirmed signal */ }
//! ```
//!
//! ## Quick start — regime detection
//! ```rust,ignore
//! use indicators::EnsembleRegimeDetector;
//! let mut det = EnsembleRegimeDetector::default_config();
//! det.update(high, low, close);
//! if det.is_ready() { println!("{}", det.regime()); }
//! ```
// ── Standalone batch indicator functions ─────────────────────────────────────
// ── Python-ported signal engine ───────────────────────────────────────────────
// ConfluenceEngine (Layer 6)
// CVDTracker (Layer 8)
// Indicators: VWAP, EMA, SuperTrend, TrendSpeed, Hurst, Accel
// LiquidityProfile (Layer 5)
// BotSettings + per-symbol defaults
// MarketStructure + Fibonacci (Layer 7)
// PercentileTracker, VolatilityPercentile, MarketRegimeTracker // compute_signal, SignalStreak
// ── Regime detection system ───────────────────────────────────────────────────
// ADX, BB, EMA, ATR, RSI used by regime detectors
// MarketRegime enum, RegimeConfidence, RegimeConfig, etc.
// ── Re-exports: signal engine ────────────────────────────────────────────────
pub use ConfluenceEngine;
pub use CVDTracker;
pub use Indicators;
pub use LiquidityProfile;
pub use BotSettings;
pub use ;
pub use MarketStructure;
pub use ;
// ── Re-exports: batch functions ──────────────────────────────────────────────
pub use ;
// ── Re-exports: incremental structs ─────────────────────────────────────────
pub use ;
// ── Re-exports: regime detection ────────────────────────────────────────────
pub use RegimeDetector;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;