Velocity Acceleration Convergence Divergence Indicator
length = 21 | smooth_length = 5 Overview
Velocity Acceleration Convergence Divergence Indicator compresses a velocity-and-acceleration transform into a two-line oscillator with a signal companion. It is useful when you want a MACD-like view built from rate-of-change behavior rather than classic moving-average separation.
In VectorTA the indicator works on a single source series or candle data, streams live values, and exposes batch sweeps over the main lookback and smoothing controls. That makes it appropriate for both fast exploratory momentum work and systematic optimization of its two length axes.
Defaults: `length = 21` and `smooth_length = 5`.
Implementation Examples
Run the indicator on a direct source slice or on candle data with the default source field.
use vector_ta::indicators::velocity_acceleration_convergence_divergence_indicator::{
velocity_acceleration_convergence_divergence_indicator,
VelocityAccelerationConvergenceDivergenceIndicatorInput,
VelocityAccelerationConvergenceDivergenceIndicatorParams,
};
let output = velocity_acceleration_convergence_divergence_indicator(
&VelocityAccelerationConvergenceDivergenceIndicatorInput::from_slice(
&close,
VelocityAccelerationConvergenceDivergenceIndicatorParams {
length: Some(21),
smooth_length: Some(5),
},
),
)?;
println!("vacd = {:?}", output.vacd.last());
println!("signal = {:?}", output.signal.last());API Reference
Input Methods ▼
VelocityAccelerationConvergenceDivergenceIndicatorInput::from_candles(&Candles, "close", VelocityAccelerationConvergenceDivergenceIndicatorParams)
-> VelocityAccelerationConvergenceDivergenceIndicatorInput
VelocityAccelerationConvergenceDivergenceIndicatorInput::from_slice(&[f64], VelocityAccelerationConvergenceDivergenceIndicatorParams)
-> VelocityAccelerationConvergenceDivergenceIndicatorInput
VelocityAccelerationConvergenceDivergenceIndicatorInput::with_default_candles(&Candles)
-> VelocityAccelerationConvergenceDivergenceIndicatorInputParameters Structure ▼
pub struct VelocityAccelerationConvergenceDivergenceIndicatorParams {
pub length: Option<usize>,
pub smooth_length: Option<usize>,
}Output Structure ▼
pub struct VelocityAccelerationConvergenceDivergenceIndicatorOutput {
pub vacd: Vec<f64>,
pub signal: Vec<f64>,
}Validation, Warmup & NaNs ▼
- The source slice must not be empty or all NaN, and the resolved
lengthandsmooth_lengthmust fit the available data. - Candles use the requested source field when building the input path.
- Streaming returns
Noneuntil the warmup for both lines completes. - Batch mode validates both range axes before expanding the sweep.
Builder, Streaming & Batch APIs ▼
VelocityAccelerationConvergenceDivergenceIndicatorBuilder::new()
.length(usize)
.smooth_length(usize)
.kernel(Kernel)
.apply(&Candles)
.apply_candles(&Candles, "close")
.apply_slice(&[f64])
VelocityAccelerationConvergenceDivergenceIndicatorStream::try_new(params)
stream.update(value) -> Option<(f64, f64)>
VelocityAccelerationConvergenceDivergenceIndicatorBatchBuilder::new()
.length_range((start, end, step))
.smooth_length_range((start, end, step))
.apply_slice(&[f64])Python Bindings
Python exposes direct, stream, and batch helpers for the VACD oscillator pair.
from vector_ta import (
velocity_acceleration_convergence_divergence_indicator,
velocity_acceleration_convergence_divergence_indicator_batch,
VelocityAccelerationConvergenceDivergenceIndicatorStream,
)
single = velocity_acceleration_convergence_divergence_indicator(close, length=21, smooth_length=5)
stream = VelocityAccelerationConvergenceDivergenceIndicatorStream(length=21, smooth_length=5)
point = stream.update(close[-1])
batch = velocity_acceleration_convergence_divergence_indicator_batch(
close,
length_range=(13, 34, 3),
smooth_length_range=(3, 9, 2),
)JavaScript/WASM Bindings
The WASM layer exposes direct, batch, allocation, and into-buffer helpers for VACD workflows.
import init, {
velocity_acceleration_convergence_divergence_indicator_js,
velocity_acceleration_convergence_divergence_indicator_batch_js,
velocity_acceleration_convergence_divergence_indicator_into,
} from "vector-ta-wasm";
await init();
const single = velocity_acceleration_convergence_divergence_indicator_js(close, 21, 5);
const batch = velocity_acceleration_convergence_divergence_indicator_batch_js(close, {
length_range: [13, 34, 3],
smooth_length_range: [3, 9, 2],
});CUDA Bindings (Rust)
Additional details for the CUDA bindings can be found inside the VectorTA repository.
Performance Analysis
Across sizes, Rust CPU runs about 1.14× faster than Tulip C in this benchmark.
AMD Ryzen 9 9950X (CPU) | NVIDIA RTX 4090 (GPU)