Rocr100
Rate of Change Ratio × 100 (
ROCR100) —close / close[period] · 100, the momentum ratio rescaled so an unchanged price reads100.
Quick reference
| Field | Value |
|---|---|
| Family | Momentum Oscillators |
| Input type | f64 (single close) |
| Output type | f64 |
| Output range | > 0; 100 = no change, > 100 advance, < 100 decline |
| Default parameters | period is required |
| Warmup period | period + 1 |
| Interpretation | A percent-of-reference momentum: 105 means price is 105% of its value period bars ago. |
Formula
For t >= period (after warmup):
ROCR100 = (close_t / close_{t-period}) · 100This is Rocr scaled by 100, so the flat line moves from 1 to 100: > 100 is an advance, < 100 a decline. The × 100 rescaling makes the series read like a "percent of the reference price" and lines up visually with percentage-style oscillators. Where the reference price is zero the result is guarded to 0. See crates/wickra-core/src/indicators/rocr100.rs.
Parameters
| Name | Type | Default | Valid range | Description | Source |
|---|---|---|---|---|---|
period | usize | none | >= 1 | Lookback distance in bars. period = 0 errors with Error::PeriodZero. | rocr100.rs:40 |
Inputs / Outputs
From crates/wickra-core/src/indicators/rocr100.rs:
use wickra::{Indicator, Rocr100};
// Rocr100: Input = f64, Output = f64
const _: fn(&mut Rocr100, f64) -> Option<f64> = <Rocr100 as Indicator>::update;Python streams as float | None, batches as a 1-D numpy.ndarray (NaN for warmup). Node streams as number | null, batches as Array<number> with NaN placeholders.
Warmup
Rocr100::new(period).warmup_period() == period + 1 (the accessors_report_config test pins warmup_period() == 4 for period = 3). The first value is emitted at input index period — the (period + 1)-th input — once a reference price period bars back is available. The known_value_is_a_scaled_ratio test pins out[0] == None.
Edge cases
- Zero reference price. When
close[period] == 0the division is guarded and the output is0. The unit testzero_reference_price_reports_zeropins this. - Constant series. A flat price returns
100for every emitted value. The unit testconstant_series_yields_one_hundredpins this. - Non-finite input.
NaN/ infinity inputs are ignored: they leave the window untouched and the last computed value is returned. The unit testnon_finite_input_holds_lastpins this. - Reset.
r.reset()clears the window and last value. The unit testreset_clears_statepins this.
Examples
Rust
use wickra::{BatchExt, Indicator, Rocr100};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut r = Rocr100::new(1)?;
let out: Vec<Option<f64>> = r.batch(&[10.0, 11.0]);
println!("{:?}", out);
Ok(())
}Output:
[None, Some(110.0)]Period 1 over [10, 11]: 11 / 10 · 100 = 110. This matches the known_value_is_a_scaled_ratio unit test in crates/wickra-core/src/indicators/rocr100.rs.
Python
import numpy as np
import wickra as ta
r = ta.Rocr100(1)
print(r.batch(np.array([10.0, 11.0])))Output:
[ nan 110.]Node
const ta = require('wickra');
const r = new ta.Rocr100(1);
for (const x of [10, 11]) console.log(x, '->', r.update(x));Output:
10 -> null
11 -> 110Interpretation
Rocr100 is identical in shape to Rocr but reads on a 100-centred scale, which many traders find more intuitive: 110 is "price is 110% of where it was", 90 is "90%". The 100 line is the flat reference; crossings mark a return to the lookback price. As with Rocr, the scale is multiplicative and asymmetric — a halving reads 50, a doubling 200.
Pick whichever of Rocp / Rocr / Rocr100 matches the scale your downstream logic expects; they carry identical information.
Common pitfalls
- Reading it as a percentage change.
ROCR100is the ratio ×100, not the change ×100. A +10% move reads110, not10; the percentage change isROCR100 − 100(here10), which isRoc. - Asymmetry around
100. Equal up/down moves are not symmetric on this scale (+10% →110, −10% →90, but the geometric pivot is100).
References
The Rate of Change Ratio ×100 is TA-Lib's ROCR100 function.
See also
- Indicator-Rocr — the same ratio centred on
1. - Indicator-Rocp — the fractional form.
- Indicator-Roc — the percentage-change form (
ROCR100 − 100). - Indicators-Overview — the full taxonomy.