Skip to main content

add_noise

Function add_noise 

Source
pub fn add_noise(bars: &[OHLCV], level: f64, rng: &mut Rng) -> Vec<OHLCV>
Expand description

Add Gaussian measurement noise to a price history.

Each bar is multiplied by exp(ε), ε ~ N(0, (level · σ)²), where σ is that symbol’s typical daily log-return volatility. level = 0.5 means “every print is wrong by about half a normal day’s move”, which is a lot more than any real data error. On top of that, high and low each get a smaller independent wobble so the bar’s shape is perturbed too (that is what ATR and the Keltner channels feel).