Skip to main content

derive_tick_size

Function derive_tick_size 

Source
pub fn derive_tick_size(price_range: f64, target_rows: usize) -> f64
Expand description

Derive a sensible TPO row size (price-bin height) from a price range and a target number of rows.

Market Profile groups price into equal bins; the bin height controls how many letters stack at each level. Rather than hard-coding a tick size that only suits one instrument, this picks a “nice” step (1, 2, 2.5 or 5 times a power of ten) so the profile lands close to target_rows regardless of whether the series trades near 1.0 or 50_000.0. Degenerate inputs (zero or non-finite range, non-positive target) fall back to 1.0.