Velocity Acceleration Indicator
length = 21 | smooth_length = 5 Overview
Velocity Acceleration Indicator turns a source series into a single acceleration-style output derived from velocity behavior. It is useful when you want a faster, more compact momentum response than a standard moving average or a two-line oscillator.
In VectorTA the indicator runs on a direct source slice or on candle data with a source field, supports streaming updates, and exposes batch sweeps over both the base length and smoothing length. That makes it a good fit for compact acceleration studies and quick parameter scans.
Defaults: `length = 21` and `smooth_length = 5`.
Implementation Examples
Run the indicator on a direct source slice or on candles with the default source field.
use vector_ta::indicators::velocity_acceleration_indicator::{
velocity_acceleration_indicator,
VelocityAccelerationIndicatorInput,
VelocityAccelerationIndicatorParams,
};
let output = velocity_acceleration_indicator(&VelocityAccelerationIndicatorInput::from_slice(
&close,
VelocityAccelerationIndicatorParams {
length: Some(21),
smooth_length: Some(5),
},
))?;
println!("value = {:?}", output.values.last());API Reference
Input Methods ▼
VelocityAccelerationIndicatorInput::from_candles(&Candles, "hlcc4", VelocityAccelerationIndicatorParams)
-> VelocityAccelerationIndicatorInput
VelocityAccelerationIndicatorInput::from_slice(&[f64], VelocityAccelerationIndicatorParams)
-> VelocityAccelerationIndicatorInput
VelocityAccelerationIndicatorInput::with_default_candles(&Candles)
-> VelocityAccelerationIndicatorInputParameters Structure ▼
pub struct VelocityAccelerationIndicatorParams {
pub length: Option<usize>,
pub smooth_length: Option<usize>,
}Output Structure ▼
pub struct VelocityAccelerationIndicatorOutput {
pub values: Vec<f64>,
}Validation, Warmup & NaNs ▼
- The source slice must contain enough valid values for both the main length and the smoothing stage.
- Candle execution uses the requested source field, with the default candle helper using
hlcc4. - Streaming returns
Noneuntil the warmup is complete. - Batch mode validates both range axes before evaluating the grid.
Builder, Streaming & Batch APIs ▼
VelocityAccelerationIndicatorBuilder::new()
.length(usize)
.smooth_length(usize)
.kernel(Kernel)
.apply(&Candles, "hlcc4")
.apply_slice(&[f64])
.into_stream()
VelocityAccelerationIndicatorStream::try_new(params)
stream.update(value) -> Option<f64>
VelocityAccelerationIndicatorBatchBuilder::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 single acceleration line.
from vector_ta import velocity_acceleration_indicator, velocity_acceleration_indicator_batch, VelocityAccelerationIndicatorStream
single = velocity_acceleration_indicator(close, length=21, smooth_length=5)
stream = VelocityAccelerationIndicatorStream(length=21, smooth_length=5)
point = stream.update(close[-1])
batch = velocity_acceleration_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 this single-output acceleration series.
import init, {
velocity_acceleration_indicator_js,
velocity_acceleration_indicator_batch_js,
velocity_acceleration_indicator_into,
} from "vector-ta-wasm";
await init();
const single = velocity_acceleration_indicator_js(close, 21, 5);
const batch = velocity_acceleration_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)