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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
//! Technical analysis indicators (studies) module.
//!
//! This module provides 150+ technical indicators commonly used in financial
//! charting applications, covering moving averages, momentum oscillators,
//! volatility measures, volume analysis, trend detection, and more.
//!
//! # Architecture
//!
//! Every indicator implements the [`Indicator`] trait, which defines a
//! uniform lifecycle:
//!
//! 1. **Construction** -- Create an indicator with its parameters
//! (e.g. `SMA::new(20)`, `RSI::new(14)`, `MACD::new(12, 26, 9)`).
//! 2. **Calculation** -- Call [`Indicator::calculate`] with a slice of [`Bar`]
//! data. The indicator computes its output values in one pass.
//! 3. **Reading results** -- Call [`Indicator::values`] to retrieve computed
//! [`IndicatorValue`]s (one per input bar). Single-line indicators emit
//! `IndicatorValue::Single(f64)`, multi-line indicators emit
//! `IndicatorValue::Multiple(Vec<f64>)`, and bars before the warmup period
//! are `IndicatorValue::None`.
//! 4. **Rendering** -- The chart engine reads [`Indicator::is_overlay`] to
//! decide whether the indicator is drawn on the main price pane or in a
//! separate sub-pane, and uses [`Indicator::colors`] /
//! [`Indicator::line_names`] for styling and legends.
//!
//! # Module layout
//!
//! | Sub-module | Purpose |
//! |---|---|
//! | `builtin` | All built-in indicators ([`SMA`], [`EMA`], [`RSI`], [`MACD`], [`BollingerBands`], ...) |
//! | [`factory`] | [`IndicatorFactory`] -- dynamic creation of indicators by name |
//! | `indicator_trait` | The core [`Indicator`] trait and [`IndicatorValue`] enum |
//! | `palette` | [`IndicatorPalette`], [`IndicatorColorSchemes`], [`ColorCategory`] |
//! | `custom` | [`CustomIndicator`] -- define indicators at runtime with closures |
//!
//! # Quick start
//!
//! ```rust,ignore
//! use egui_charts::studies::{SMA, RSI, BollingerBands, Indicator};
//!
//! // Create indicators
//! let mut sma = SMA::new(20);
//! let mut rsi = RSI::new(14);
//! let mut bb = BollingerBands::new(20, 2.0);
//!
//! // Calculate on bar data
//! sma.calculate(&bars);
//! rsi.calculate(&bars);
//! bb.calculate(&bars);
//!
//! // Or use the registry for batch calculation
//! let mut registry = IndicatorRegistry::new();
//! registry.add(Box::new(SMA::new(50)));
//! registry.add(Box::new(RSI::new(14)));
//! registry.calculate_all(&bars);
//! ```
pub use *;
pub use CustomIndicator;
pub use IndicatorFactory;
pub use ;
pub use ;
use crateBar;
/// A registry that owns a collection of [`Indicator`] trait objects and
/// provides batch operations (calculate all, clear, etc.).
///
/// Use the registry when you want to manage multiple indicators as a group
/// and recalculate them together whenever the underlying bar data changes.
///
/// # Example
///
/// ```rust,ignore
/// use egui_charts::studies::{IndicatorRegistry, SMA, EMA};
///
/// let mut registry = IndicatorRegistry::new();
/// registry.add(Box::new(SMA::new(20)));
/// registry.add(Box::new(EMA::new(50)));
/// registry.calculate_all(&bars);
///
/// for indicator in registry.indicators() {
/// println!("{}: {} values", indicator.name(), indicator.values().len());
/// }
/// ```