Volume Energy Reservoirs

Parameters: length = 20 | sensitivity = 1.5

Overview

Volume Energy Reservoirs is a multi-output structure study that tracks momentum, a reservoir state, squeeze activity, squeeze starts, and range bounds from high-low-close-volume input. It is useful when you want a compact view of stored energy, breakout readiness, and active range context from one indicator call.

In VectorTA the indicator works on HLCV slices or candle data, supports live streaming updates and reset behavior, and exposes batch sweeps across the main lookback and sensitivity controls. That makes it well suited for squeeze-style scans and range-expansion studies.

Defaults: `length = 20` and `sensitivity = 1.5`.

Implementation Examples

Run the indicator on direct HLCV slices or on candles with the default reservoir settings.

use vector_ta::indicators::volume_energy_reservoirs::{
    volume_energy_reservoirs,
    VolumeEnergyReservoirsInput,
    VolumeEnergyReservoirsParams,
};

let output = volume_energy_reservoirs(&VolumeEnergyReservoirsInput::from_slices(
    &high,
    &low,
    &close,
    &volume,
    VolumeEnergyReservoirsParams {
        length: Some(20),
        sensitivity: Some(1.5),
    },
))?;

println!("momentum = {:?}", output.momentum.last());
println!("reservoir = {:?}", output.reservoir.last());

API Reference

Input Methods
VolumeEnergyReservoirsInput::from_candles(&Candles, VolumeEnergyReservoirsParams)
    -> VolumeEnergyReservoirsInput

VolumeEnergyReservoirsInput::from_slices(&[f64], &[f64], &[f64], &[f64], VolumeEnergyReservoirsParams)
    -> VolumeEnergyReservoirsInput

VolumeEnergyReservoirsInput::with_default_candles(&Candles)
    -> VolumeEnergyReservoirsInput
Parameters Structure
pub struct VolumeEnergyReservoirsParams {
    pub length: Option<usize>,
    pub sensitivity: Option<f64>,
}
Output Structure
pub struct VolumeEnergyReservoirsOutput {
    pub momentum: Vec<f64>,
    pub reservoir: Vec<f64>,
    pub squeeze_active: Vec<f64>,
    pub squeeze_start: Vec<f64>,
    pub range_high: Vec<f64>,
    pub range_low: Vec<f64>,
}
Validation, Warmup & NaNs
  • High, low, close, and volume inputs must share the same non-zero length and contain enough data for the resolved length.
  • The resolved sensitivity must pass the Rust validation checks.
  • Streaming exposes a warmup period and returns None until the reservoir state is ready.
  • Batch mode validates the length and sensitivity axes before generating the grid.
Builder, Streaming & Batch APIs
VolumeEnergyReservoirsBuilder::new()
    .length(usize)
    .sensitivity(f64)
    .kernel(Kernel)
    .apply(&Candles)
    .apply_slices(&[f64], &[f64], &[f64], &[f64])
    .into_stream()

VolumeEnergyReservoirsStream::try_new(params)
stream.update(high, low, close, volume)

VolumeEnergyReservoirsBatchBuilder::new()
    .length_range(start, end, step)
    .sensitivity_range(start, end, step)
    .apply_slices(&[f64], &[f64], &[f64], &[f64])

Python Bindings

Python exposes direct, stream, and batch helpers for the full reservoir output set.

from vector_ta import volume_energy_reservoirs, volume_energy_reservoirs_batch, VolumeEnergyReservoirsStream

single = volume_energy_reservoirs(high, low, close, volume, length=20, sensitivity=1.5)
stream = VolumeEnergyReservoirsStream(length=20, sensitivity=1.5)
point = stream.update(high[-1], low[-1], close[-1], volume[-1])
batch = volume_energy_reservoirs_batch(
    high,
    low,
    close,
    volume,
    length_range=(10, 30, 5),
    sensitivity_range=(1.0, 2.0, 0.25),
)

JavaScript/WASM Bindings

The WASM layer exposes direct, batch, allocation, and into-buffer helpers for reservoir calculations.

import init, { volume_energy_reservoirs_js, volume_energy_reservoirs_batch_js } from "vector-ta-wasm";

await init();

const single = volume_energy_reservoirs_js(high, low, close, volume, 20, 1.5);
const batch = volume_energy_reservoirs_batch_js(high, low, close, volume, {
  length_range: [10, 30, 5],
  sensitivity_range: [1.0, 2.0, 0.25],
});

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