Wavelet Multi Scale Decomposition
A moving average blends every timescale into one number. This separates them. Using an undecimated ("a trous") Haar wavelet transform, price is split into three detail bands plus a coarse approximation: Detail 1 captures the fastest, bar-to-bar variation; Detail 2 a medium horizon; Detail 3 a slower one; and the approximation is what remains once all three have been removed. The classic decimated Haar transform halves the sample count at every level, leaving values only every 2, 4, 8 bars - awkward to align with an ordinary one-value-per-bar indicator buffer. The undecimated version used here instead widens the averaging filter at each level while keeping one output per bar: level j's approximation at a given bar averages the previous level's approximation at that bar with the value 2^(j-1) bars OLDER, never newer, which is what keeps every level strictly causal. Detail j is simply what that averaging step removed - the band of variation specific to roughly that timescale. Because the coarse approximation is a smoothed PRICE LEVEL while the detail bands are small pip-scale deviations, plotting the raw approximation on the same subwindow axis would flatten the detail lines into an unreadable sliver near zero. Instead the fourth line plots the approximation's GAP from the actual close - how far current price currently sits from its own multi-bar smoothed trend - which keeps all four lines on a comparable scale and is arguably the more useful number in practice. Notes and limitations - Needs a handful of bars of history (a few more than the deepest level's shift) before the slowest band can be computed; earlier bars are intentionally left empty. - This is a fixed three-level decomposition, not a configurable one - the three shifts (1, 2 and 4 bars) are chosen to give a fast/medium/slow spread without needing extra inputs to tune. - The Haar wavelet is the simplest possible wavelet (a single step function); it resolves timescale cleanly but has coarser frequency resolution than more elaborate wavelet families. - Every level only ever looks at the current bar and older bars, so nothing here can repaint a bar that has already closed.
Indicator · MT4 · v1.0 · Free
About Wavelet Multi Scale Decomposition
Wavelet Multi Scale Decomposition is an indicator for MetaTrader 4. It has 1 setting, such as Plot in pips. MQL source code included.
Files in the download: WaveletMultiScaleDecomposition.ex4, WaveletMultiScaleDecomposition.mq4, WaveletMultiScaleDecomposition.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Plot in pips | true | Scale detail/approximation bands to pips instead of raw price units |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Moving Average · MT4 Indicator · MQL4 Source Code