Volatility Quality Index

Parameters: fast_length = 9 | slow_length = 200

Overview

Volatility Quality Index turns OHLC price structure into a volatility-weighted trend measure and pairs it with fast and slow moving-average views of that same pressure. It is useful when you want a broader quality-of-move filter rather than a simple volatility estimate.

In VectorTA the indicator works on full OHLC input, supports direct slice execution, streaming updates, and batch sweeps across the fast and slow smoothing lengths. That makes it a good fit for filtering breakout quality, ranking trend persistence, or building regime overlays.

Defaults: `fast_length = 9` and `slow_length = 200`.

Implementation Examples

Run the indicator on direct OHLC slices or on candle data with the default lengths.

use vector_ta::indicators::volatility_quality_index::{
    volatility_quality_index,
    VolatilityQualityIndexInput,
    VolatilityQualityIndexParams,
};

let output = volatility_quality_index(&VolatilityQualityIndexInput::from_slices(
    &open,
    &high,
    &low,
    &close,
    VolatilityQualityIndexParams {
        fast_length: Some(9),
        slow_length: Some(200),
    },
))?;

println!("vqi = {:?}", output.vqi_sum.last());
println!("fast = {:?}", output.fast_sma.last());

API Reference

Input Methods
VolatilityQualityIndexInput::from_candles(&Candles, VolatilityQualityIndexParams)
    -> VolatilityQualityIndexInput

VolatilityQualityIndexInput::from_slices(&[f64], &[f64], &[f64], &[f64], VolatilityQualityIndexParams)
    -> VolatilityQualityIndexInput

VolatilityQualityIndexInput::with_default_candles(&Candles)
    -> VolatilityQualityIndexInput
Parameters Structure
pub struct VolatilityQualityIndexParams {
    pub fast_length: Option<usize>,
    pub slow_length: Option<usize>,
}
Output Structure
pub struct VolatilityQualityIndexOutput {
    pub vqi_sum: Vec<f64>,
    pub fast_sma: Vec<f64>,
    pub slow_sma: Vec<f64>,
}
Validation, Warmup & NaNs
  • Open, high, low, and close inputs must share the same non-zero length and contain enough data for both smoothing windows.
  • The resolved fast_length and slow_length must pass the Rust validator.
  • Streaming returns None until the indicator and both averages are warmed up.
  • Batch mode validates both range axes before expanding the matrix.
Builder, Streaming & Batch APIs
VolatilityQualityIndexBuilder::new()
    .fast_length(usize)
    .slow_length(usize)
    .kernel(Kernel)
    .apply(&Candles)
    .apply_slices(&[f64], &[f64], &[f64], &[f64])
    .into_stream()

VolatilityQualityIndexStream::try_new(params)
stream.update(open, high, low, close) -> Option<(f64, f64, f64)>

VolatilityQualityIndexBatchBuilder::new()
    .fast_length_range(start, end, step)
    .slow_length_range(start, end, step)
    .apply_slices(&[f64], &[f64], &[f64], &[f64])

Python Bindings

Python exposes direct, stream, and batch helpers for the VQI core and its fast/slow average companions.

from vector_ta import volatility_quality_index, volatility_quality_index_batch, VolatilityQualityIndexStream

single = volatility_quality_index(open, high, low, close, fast_length=9, slow_length=200)
stream = VolatilityQualityIndexStream(fast_length=9, slow_length=200)
row = stream.update(open[-1], high[-1], low[-1], close[-1])
batch = volatility_quality_index_batch(
    open,
    high,
    low,
    close,
    fast_length_range=(5, 15, 2),
    slow_length_range=(50, 200, 50),
)

JavaScript/WASM Bindings

The WASM layer exposes direct, batch, allocation, and into-buffer helpers for VQI workflows.

import init, {
  volatility_quality_index_js,
  volatility_quality_index_batch_js,
} from "vector-ta-wasm";

await init();

const single = volatility_quality_index_js(open, high, low, close, 9, 200);
const batch = volatility_quality_index_batch_js(open, high, low, close, {
  fast_length_range: [5, 15, 2],
  slow_length_range: [50, 200, 50],
});

CUDA Bindings (Rust)

Additional details for the CUDA bindings can be found inside the VectorTA repository.

Performance Analysis

Comparison:
View:
Placeholder data (no recorded benchmarks for this indicator)

Across sizes, Rust CPU runs about 1.14× faster than Tulip C in this benchmark.

Loading chart...

AMD Ryzen 9 9950X (CPU) | NVIDIA RTX 4090 (GPU)

Related Indicators