# Wavelet Decomposition

Wavelet Decomposition is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Runs a shift-invariant wavelet pyramid over a rolling 256-bar window, splitting the source into stacked detail lanes (D1 holding 2-4 bar moves, each level an octave slower) plus a trend approximation, all summing back to the source exactly. Denoised and trend reconstructions draw over price, the revising right edge is shaded, and an energy table ranks the timescales.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jun 18, 2026.
- Access: free.
- Concepts: [Wavelet Decomposition](https://www.luxalgo.com/library/concept/wavelet-decomposition/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=qjgsxay5p37ruhh8ckack2tc
- Page: https://www.luxalgo.com/library/indicator/wavelet-decomposition/

**Wavelet Decomposition** takes a series apart by timescale and proves the parts add back up, the library's first faithful implementation of [wavelet decomposition](https://www.luxalgo.com/library/concept/wavelet-decomposition/). A shift-invariant transform splits a rolling window into detail levels, each an octave of fluctuation (D1 spans 2-4 bars, D2 4-8, and so on), plus an approximation of everything slower. Details stack in the pane on a shared amplitude scale, denoised and trend reconstructions draw over price, and an energy table ranks the scales, its last row verifying the additive identity.

## How to Trade the Wavelet Decomposition?

- **Denoised crosses**: price crossing the denoised reconstruction (approximation plus surviving details) is alerted both ways.
- **Trend turns**: the approximation's slope flipping sign is alerted, the trend-extraction use.
- **Dominant scale**: the strongest table shading marks the level with the most detail energy; a shift there is alerted.
- **Boundary zone**: the shaded right edge comes from padded data and revises, provisional by construction.

## Wavelet Decomposition Settings

- **Source** (default close): the series decomposed.
- **Analysis Window** (default 256): rolling bars the pyramid recomputes over.
- **Levels (J)** (default 4): depth, auto-reduced when the deepest filter no longer fits the window.
- **Wavelet Family** (default Daubechies-4): Haar is simplest and most edge-friendly; Daubechies filters smooth more with wider boundary effects.
- **Boundary Handling** (default Reflection): mirror the sample edges, or wrap with Periodic.
- **Suppress Finest Levels (K)** (default 2) and **Denoise Mode** (default Suppress): zero the K fastest levels, or shrink their coefficients with Soft Threshold's median-based universal threshold.
- Display (all on): **Denoised Reconstruction**, **Trend (Approximation)**, **Detail Stack**, **Energy Table** and **Boundary Zone**; **Line Width** (default 2).

## Frequently Asked Questions

### Why use wavelets instead of a Kalman filter?

A [Kalman Filter](https://www.luxalgo.com/library/indicator/kalman-filter/) runs a recursive model forward: one smoothed state per bar, never revised. Wavelets analyze a whole window at once and separate every timescale: richer, but with edge values that revise as the window rolls.

### What exactly is the boundary problem?

The filters need data beyond both sample ends, so edges are padded by reflection or wrap-around; padded values revise as real bars replace them. The build shades the region and repeats the caveat in its alerts.

### Which wavelet family should I choose?

Daubechies-4 is the common default: smoother than Haar at modest filter length. Haar minimizes edge effects and follows sharp moves best; Daubechies-6 smooths further with a wider revising edge.

## Related indicators

- [Spline Quantile Regression Channel](https://www.luxalgo.com/library/indicator/spline-quantile-regression-channel/) (Polynomial Regression): markdown at https://www.luxalgo.com/library/indicator/spline-quantile-regression-channel.md
- [Bitcoin Power Law](https://www.luxalgo.com/library/indicator/bitcoin-power-law/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/bitcoin-power-law.md
- [Recursive Least Squares Forecast](https://www.luxalgo.com/library/indicator/recursive-least-squares-forecast/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/recursive-least-squares-forecast.md
- [Adaptive Harmonic Forecast](https://www.luxalgo.com/library/indicator/adaptive-harmonic-forecast/) (FFT/spectral Analysis): markdown at https://www.luxalgo.com/library/indicator/adaptive-harmonic-forecast.md
- [Kalman Filter](https://www.luxalgo.com/library/indicator/kalman-filter/) (Statistics): markdown at https://www.luxalgo.com/library/indicator/kalman-filter.md
- [Bitcoin Expectile Model](https://www.luxalgo.com/library/indicator/bitcoin-expectile-model/) (Quantile Regression): markdown at https://www.luxalgo.com/library/indicator/bitcoin-expectile-model.md
- [Rolling Segment](https://www.luxalgo.com/library/indicator/rolling-segment/) (Linear Regression): markdown at https://www.luxalgo.com/library/indicator/rolling-segment.md
- [Daily Polynomial Regressions](https://www.luxalgo.com/library/indicator/daily-polynomial-regressions/) (Polynomial Regression): markdown at https://www.luxalgo.com/library/indicator/daily-polynomial-regressions.md

---

Source: https://www.luxalgo.com/library/indicator/wavelet-decomposition/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
