pub fn roc(data: &[f64], period: usize) -> Result<Vec<Option<f64>>>Expand description
Calculate Rate of Change (ROC).
Percentage change over period. ROC = ((Price - Price[n periods ago]) / Price[n periods ago]) * 100
§Arguments
data- Price data (typically close prices)period- Number of periods
§Example
use finance_query::indicators::roc;
let prices = vec![10.0, 11.0, 12.0, 13.0];
let result = roc(&prices, 2).unwrap();