rsi_cycle_stats
RSI Cycle Statistics: cycle state machine origin -> armed -> success / failure / timeout between the overbo…
rsi_cycle_stats
examples/site_showcase.rs// RSI Cycle Statistics: cycle state machine origin -> armed -> success / failure / timeout between the overbought and oversold zones, completed cycles stored with progress-bucket timing; the live cycle gets the progress- and age-conditioned completion frequency of past cycles within lookback bars (past data only), base rate, edge and Wilson interval; value = RSI; extra: cycle_dir, progress, max_progress, age, cond_n, conditional, base_rate, edge, ci_low, ci_high, median_duration; alerts bull/bear_cycle_opportunity (once per cycle at a bucket crossing in the zone with enough samples, edge and a narrow interval; prefix = cycle direction), cycle_success, cycle_failure, cycle_timeout
// Defaults of "rsi_cycle_stats" (see the indicator reference)
let params = HashMap::from([
("edge_th".to_string(), 15.0),
("lookback".to_string(), 1000.0),
("max_ci".to_string(), 40.0),
("max_cycle".to_string(), 150.0),
("min_samples".to_string(), 20.0),
("overbought".to_string(), 70.0),
("oversold".to_string(), 30.0),
("rsi_len".to_string(), 14.0),
]);
let mut indicator = build_checked("rsi_cycle_stats", ¶ms)?;
for bar in &bars {
if let Some(output) = indicator.on_bar(bar) {
// output.value, output.extra[...], indicator.alerts()
}
}