Volatility Ratio Adaptive RSX

Parameters: period = 14 | speed = 0.5

Overview

Volatility Ratio Adaptive RSX produces a two-line adaptive oscillator that adjusts its RSX-style response using a volatility-ratio speed control. It is useful when you want a smoother oscillator than a classic RSI while still allowing responsiveness to change with market conditions.

In VectorTA the indicator works on a single source slice or candle data, supports streaming updates, and exposes batch sweeps across both the period and speed controls. That makes it suitable for adaptive oscillator studies and systematic tuning of responsiveness.

Defaults: `period = 14` and `speed = 0.5`.

Implementation Examples

Run the indicator on a source slice or on candles using the default close source.

use vector_ta::indicators::volatility_ratio_adaptive_rsx::{
    volatility_ratio_adaptive_rsx,
    VolatilityRatioAdaptiveRsxInput,
    VolatilityRatioAdaptiveRsxParams,
};

let output = volatility_ratio_adaptive_rsx(&VolatilityRatioAdaptiveRsxInput::from_slice(
    &close,
    VolatilityRatioAdaptiveRsxParams {
        period: Some(14),
        speed: Some(0.5),
    },
))?;

println!("line = {:?}", output.line.last());
println!("signal = {:?}", output.signal.last());

API Reference

Input Methods
VolatilityRatioAdaptiveRsxInput::from_candles(&Candles, "close", VolatilityRatioAdaptiveRsxParams)
    -> VolatilityRatioAdaptiveRsxInput

VolatilityRatioAdaptiveRsxInput::from_slice(&[f64], VolatilityRatioAdaptiveRsxParams)
    -> VolatilityRatioAdaptiveRsxInput

VolatilityRatioAdaptiveRsxInput::with_default_candles(&Candles)
    -> VolatilityRatioAdaptiveRsxInput
Parameters Structure
pub struct VolatilityRatioAdaptiveRsxParams {
    pub period: Option<usize>,
    pub speed: Option<f64>,
}
Output Structure
pub struct VolatilityRatioAdaptiveRsxOutput {
    pub line: Vec<f64>,
    pub signal: Vec<f64>,
}
Validation, Warmup & NaNs
  • The source slice must contain enough valid data for the resolved period.
  • Candle execution uses the requested source field, with the default candle helper using close.
  • Streaming returns None until the adaptive line and signal are warmed up.
  • Batch mode validates the period and speed range axes before building the grid.
Builder, Streaming & Batch APIs
VolatilityRatioAdaptiveRsxBuilder::new()
    .period(usize)
    .speed(f64)
    .kernel(Kernel)
    .apply(&Candles)
    .apply_slice(&[f64])
    .into_stream()

VolatilityRatioAdaptiveRsxStream::try_new(params)
stream.update(value) -> Option<(f64, f64)>

VolatilityRatioAdaptiveRsxBatchBuilder::new()
    .period_range(start, end, step)
    .speed_range(start, end, step)
    .apply_slice(&[f64])

Python Bindings

Python exposes direct, stream, and batch helpers for the adaptive RSX line and signal pair.

from vector_ta import volatility_ratio_adaptive_rsx, volatility_ratio_adaptive_rsx_batch, VolatilityRatioAdaptiveRsxStream

single = volatility_ratio_adaptive_rsx(close, period=14, speed=0.5)
stream = VolatilityRatioAdaptiveRsxStream(period=14, speed=0.5)
point = stream.update(close[-1])
batch = volatility_ratio_adaptive_rsx_batch(close, period_range=(7, 21, 7), speed_range=(0.2, 1.0, 0.2))

JavaScript/WASM Bindings

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

import init, {
  volatility_ratio_adaptive_rsx_js,
  volatility_ratio_adaptive_rsx_batch_js,
  volatility_ratio_adaptive_rsx_into_host,
} from "vector-ta-wasm";

await init();

const single = volatility_ratio_adaptive_rsx_js(close, 14, 0.5);
const batch = volatility_ratio_adaptive_rsx_batch_js(close, {
  period_range: [7, 21, 7],
  speed_range: [0.2, 1.0, 0.2],
});

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