Skip to main content

Module factory

Module factory 

Source
Expand description

Indicator factory for dynamic indicator creation by name.

The IndicatorFactory provides a registry of constructor functions keyed by indicator name strings. The built-in catalogue is registered under its canonical Indicator::name key and a category, and users can add their own at runtime. It is the catalogue of studies: a picker lists list, describes each entry with Indicator::desc and category, and creates it with create.

§Example

use egui_charts::studies::IndicatorFactory;

let factory = IndicatorFactory::new(); // includes all built-ins
let rsi = factory.create("RSI").unwrap();
assert_eq!(rsi.name(), "RSI");

// Register a custom entry
let mut factory = factory;
factory.register("MySMA", || Box::new(egui_charts::studies::SMA::new(42)));

Structs§

IndicatorFactory
A factory that creates Indicator instances by name.