Indicator Math
A Rust library for technical analysis indicators (SMA, EMA, WMA, HMA, MACD) and automated trend analysis.
Usage
Add this to your Cargo.toml:
[]
= "0.6.4"
Getting Trading Actions
{Candle, analyze_ema, get_action_by_simple};
{
// 1. Prepare your candle data
= vec![
time: 1735344000, open: 150.0, high: 155.0, low: 149.0, close: 152.0 },
// ... add more candles (at least enough to satisfy your EMA period)
];
// 2. Run the analysis (Short Period: 10, Long Period: 20)
= analyze_ema(&candles, 10, 20);
// 3. Get action for the latest data point
analysis_results.is_empty() {
= analysis_results.len() - 1;
= get_action_by_simple(&analysis_results, last_index);
=> println!("🚀 Signal: CALL (Short EMA is above Long EMA)"),
=> println!("🔻 Signal: PUT (Long EMA is above Short EMA)"),
=> println!("↔️ Signal: HOLD (Neutral)"),
=> println!("No signal available"),
}
}
}