kestrel-chartkitv0.33.0

← All examples

roc_context

ROC Context: percentage ROC

roc_context

examples/site_showcase.rs
// ROC Context: percentage ROC (roc_len) smoothed (avg_len, ma_kind 0 EMA, 1 SMA, 2 RMA) with a signal line (sig_len) and a slow context ROC (ctx_len); value = line, secondary = signal; extra: hist, context, sentiment (-100..100 stretch depth), stall (+1 line falling while price holds, -1 rising), divergence (fast vs. context), quality on stretch-cross bars; alerts bull/bear_cross (signal cross out of the stretch zone, context agrees, no stall against), bull/bear_cross_weak (with stall against or counter-context), bull/bear_zero_cross, bull/bear_stall (first stall bar); prefix = expected move
// Defaults of "roc_context" (see the indicator reference)
let params = HashMap::from([
    ("avg_len".to_string(), 3.0),
    ("ctx_len".to_string(), 50.0),
    ("ma_kind".to_string(), 0.0),
    ("ob_level".to_string(), 5.0),
    ("os_level".to_string(), -5.0),
    ("roc_len".to_string(), 12.0),
    ("sig_len".to_string(), 9.0),
    ("stall_len".to_string(), 5.0),
]);
let mut indicator = build_checked("roc_context", &params)?;

for bar in &bars {
    if let Some(output) = indicator.on_bar(bar) {
        // output.value, output.extra[...], indicator.alerts()
    }
}
ROC Context: percentage ROC (roc_len) smoothed (avg_len, ma_kind 0 EMA, 1 SMA, 2 RMA) with a signal line (sig_len) and a slow context ROC (ctx_len); value = line, secondary = signal; extra: hist, context, sentiment (-100..100 stretch depth), stall (+1 line falling while price holds, -1 rising), divergence (fast vs. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 7 alerts in view, the latest as markers.ROC Context: percentage ROC (roc_len) smoothed (avg_len, ma_kind 0 EMA, 1 SMA, 2 RMA) with a signal line (sig_len) and a slow context ROC (ctx_len); value = line, secondary = signal; extra: hist, context, sentiment (-100..100 stretch depth), stall (+1 line falling while price holds, -1 rising), divergence (fast vs. Default parameters on synthetic 4-hour bars of a fictitious CASOON share (invented prices), the last 150 bars; 7 alerts in view, the latest as markers.
  • Composite read-outs, part 1
  • unit: Ratio