Wave Smoother

Parameters: period = 20 | phase = 70

Overview

Wave Smoother is a single-line smoothing filter designed to preserve wave shape while reducing noise. It is useful when you want a cleaner oscillatory source for downstream indicators, cycle work, or chart overlays without switching to a broader moving-average family.

In VectorTA the indicator works on a direct source slice or candle data with an explicit field, supports streaming updates, and exposes batch sweeps over both period and phase. That makes it a flexible preprocessing stage for other studies as well as a standalone smoothing overlay.

Defaults: `period = 20` and `phase = 70.0`.

Implementation Examples

Run Wave Smoother on a source slice or on candles with the default close source.

use vector_ta::indicators::wave_smoother::{wave_smoother, WaveSmootherInput, WaveSmootherParams};

let output = wave_smoother(&WaveSmootherInput::from_slice(
    &close,
    WaveSmootherParams {
        period: Some(20),
        phase: Some(70.0),
    },
))?;

println!("smoothed = {:?}", output.values.last());

API Reference

Input Methods
WaveSmootherInput::from_candles(&Candles, "close", WaveSmootherParams)
    -> WaveSmootherInput

WaveSmootherInput::from_slice(&[f64], WaveSmootherParams)
    -> WaveSmootherInput

WaveSmootherInput::with_default_candles(&Candles)
    -> WaveSmootherInput
Parameters Structure
pub struct WaveSmootherParams {
    pub period: Option<usize>,
    pub phase: Option<f64>,
}
Output Structure
pub struct WaveSmootherOutput {
    pub values: Vec<f64>,
}
Validation, Warmup & NaNs
  • The source slice must contain enough valid data for the resolved period.
  • The default candle helper uses the close field, while the explicit candle path accepts another source field.
  • Streaming returns None until the smoother is warmed up and also exposes a reset path.
  • Batch mode validates both the period and phase range axes before evaluating the grid.
Builder, Streaming & Batch APIs
WaveSmootherBuilder::new()
    .period(usize)
    .phase(f64)
    .kernel(Kernel)
    .apply(&Candles, "close")
    .apply_slice(&[f64])
    .into_stream()

WaveSmootherStream::try_new(params)
stream.update(value) -> Option<f64>
stream.reset()

WaveSmootherBatchBuilder::new()
    .period_range(start, end, step)
    .phase_range(start, end, step)
    .apply_slice(&[f64])

Python Bindings

Python exposes direct, stream, and batch helpers for the single smoothing line.

from vector_ta import wave_smoother, wave_smoother_batch, WaveSmootherStream

single = wave_smoother(close, period=20, phase=70.0)
stream = WaveSmootherStream(period=20, phase=70.0)
point = stream.update(close[-1])
batch = wave_smoother_batch(close, period_range=(10, 30, 10), phase_range=(30.0, 70.0, 20.0))

JavaScript/WASM Bindings

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

import init, { wave_smoother_js, wave_smoother_batch_js, wave_smoother_into_host } from "vector-ta-wasm";

await init();

const single = wave_smoother_js(close, 20, 70.0);
const batch = wave_smoother_batch_js(close, {
  period_range: [10, 30, 10],
  phase_range: [30.0, 70.0, 20.0],
});

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