Wavelet Energy Cascade TradingView Indicator

Trend tools struggle when a market goes quiet. Also, wavelet Energy Cascade works as a market regime indicator TradingView traders can use to tell those two states apart. It splits price into four Haar wavelet scales, measures the energy held in each, then weighs the coarse scales against the fine ones. Indeed, when slow structure carries more energy than bar-to-bar noise, the chart counts as trending. Signals fire only inside that regime.

It is free and open source. Still, you can add it to any chart from the Wavelet Energy Cascade script page on TradingView, and the full Pine source is published there for you to read.

What Wavelet Energy Cascade plots on the price chart

The script runs on the price chart. Thus, it plots one thick line, the 8-bar coarse Haar smoother. That line turns yellow-green in a bullish trending regime, orange-red in a bearish one, and grey when the regime reads mixed. Hence, flag shapes mark signals in three stacked layers for a glow effect, tagged WEC up or WEC dn. Signal bars get painted, and a faint background tint shows the live regime. Next, a nine-row dashboard sits top right with all four scale energies, the coarse over fine ratio, regime, position and bars since the last signal.

How Wavelet Energy Cascade is built

The Haar filter bank

A Haar wavelet coefficient is just a difference of two averages. Then, the script builds one at four scales: s equals 1, 2, 4 and 8. At each scale it averages the s most recent closes. Then it averages the s closes before those, subtracts, and divides by the square root of two. Scale 8 therefore reads a 16-bar window.

This is a Haar filter bank, not a full multi-resolution transform. Yet, the code never downsamples the series. Every coefficient updates on every bar. Truly, that keeps the output lined up with the chart. It also keeps the math simple enough to audit line by line.

Energy comes next. Plainly, the script squares each coefficient, then sums it over the Energy Lookback. That lookback starts at 40 bars and ranges from 10 to 200. Squaring strips out direction. What remains measures how much movement lives at each scale.

The regime gate and the entry

Fine energy adds scales 1 and 2. Also, coarse energy adds scales 4 and 8. The script calls the market trending when coarse energy beats fine energy by the Coarse / Fine Dominance factor. Indeed, that factor starts at 1.5 and runs from 1.0 to 5.0. Raise it and you demand cleaner structure before anything fires.

Entries need three conditions at once. The regime must read trending. Close must cross the 8-bar coarse line. Still, and the scale-8 coefficient must agree, so positive for a buy and negative for a sell. A cross that fights the coarse coefficient gets dropped.

Two more gates then apply. Thus, the script holds a position state, so it never prints two buys without a sell between them. A cooldown of 4 bars, adjustable up to 20, spaces signals out. Hence, every signal also waits for barstate.isconfirmed. The flag appears only after the bar closes, so nothing repaints.

How to read the signals

Start with the dashboard, not the flags. Next, the coarse over fine row prints a single number. Above 1.5 the regime reads trending and the background tints. Then, near 1.0 the fine scales hold as much energy as the coarse ones, which is the signature of chop. A reading above 3.0 has its own alert, and those stretches are where the coarse line behaves best.

The line color carries the sign of the scale-8 coefficient. Yet, yellow-green means the 16-bar Haar difference sits positive. Orange-red means it sits negative. Truly, grey means the regime failed the dominance test, so treat crosses of the line as noise until color returns.

Flags land at the open of the next bar because the signal needs a closed candle. That is deliberate. Your historical chart matches what you would have seen live. Plainly, still, plan entries around that extra bar of range. Also watch the Last Signal row, since the 4-bar cooldown may have swallowed a second cross you expected.

Every Wavelet Energy Cascade setting explained

The script exposes 8 inputs, grouped in the settings panel exactly as shown below. Defaults are the published values.

Wavelet

SettingWhat it doesDefaultRange
Energy LookbackSets the energy lookback used in the calculation.4010 to 200

Signal

SettingWhat it doesDefaultRange
Coarse / Fine DominanceCoarse-scale energy must exceed fine by this factor for trending regime.1.51.0 to 5.0
Cooldown BarsSets the cooldown bars used in the calculation.41 to 20

Visual

SettingWhat it doesDefaultRange
Show DashboardToggles show dashboard on the chart.onon / off
Show 3-Layer GlowToggles show 3-layer glow on the chart.onon / off
Show Coarse Wavelet LineToggles show coarse wavelet line on the chart.onon / off
Buy Color (Yellow-Green)Colour used for buy color (yellow-green).#aeea00
Sell Color (Orange-Red)Colour used for sell color (orange-red).#ff3d00

Alerts built into Wavelet Energy Cascade

The script ships 11 alert conditions. Also, open the alert dialog on the chart, pick the indicator as the condition source, then choose the event you want. Alerts fire on the close of the bar, so they follow the same confirmed-bar rule the on-chart signals use.

  • WEC Buy
  • WEC Sell
  • WEC Any Signal
  • WEC Trend Start
  • WEC Trend End
  • WEC Strong Trend
  • WEC Cross Up
  • WEC Cross Down
  • WEC Webhook JSON

Other markets and timeframes

Nothing here is tied to forex, and the script never reads volume. Indeed, the energies scale with the instrument’s price, but the test compares coarse energy against fine energy. That ratio is scale-free, so gold, indices, crypto and equities all work on the default 1.5 setting without retuning. Still, the Energy Lookback is the one input worth revisiting. Fast intraday charts suit a shorter window, while daily charts hold their regime longer and tolerate the full 200 bars.

Limitations worth knowing

The coarse line is a simple 8-bar average, so entries are moving-average crosses at heart. They lag turns. The regime test lags too, because energy sums the last 40 bars. Thus, a trend can end while the dominance ratio still reads above 1.5.

This is a filter bank, not a full discrete wavelet transform. Hence, it uses four fixed scales and one fixed split, coarse 4 plus 8 against fine 1 plus 2. You cannot choose different scales from the inputs. Next, deeper scales beyond 16 bars stay outside its view.

The script carries no stops, no targets and no position sizing. Then, it never calls request.security, so everything runs on your chart timeframe only. The 4-bar cooldown and the position state can also suppress a valid second entry inside a fast move.

Get Wavelet Energy Cascade on TradingView

Open Wavelet Energy Cascade on TradingView

If you also trade MetaTrader, the MT4 and MT5 indicator library is available below.

Get the complete indicator library

One email unlocks the full MT4 and MT5 indicator library. Yet, this TradingView script stays free on TradingView – the button above adds it to your chart.

Using it alongside MetaTrader

Adding a script on TradingView takes one click, so there is no install step here. Truly, if you want the same idea on MetaTrader, the MT4 and MT5 indicator installation guide walks through copying files into the data folder and attaching them to a chart. You can also browse the full MetaTrader indicator library, the MT4 indicators section, or the other free TradingView scripts published on this profile. For related chart tools see the MT5 indicators section and the forex trading strategies guides.

External references

Frequently asked questions

Does Wavelet Energy Cascade repaint?

No. Plainly, every signal gates on barstate.isconfirmed, so a flag prints only after the bar closes. The coarse line and the energy readings do update live inside the forming bar, which is normal. Also, the flags themselves stay fixed once printed.

Is this a real wavelet transform?

It computes real Haar wavelet coefficients at scales 1, 2, 4 and 8. Indeed, each one is the difference between two half-window averages, divided by the square root of two. It does not downsample between scales, so call it a Haar filter bank rather than a full multi-resolution decomposition.

What does the coarse over fine number mean?

It divides summed energy at scales 4 and 8 by summed energy at scales 1 and 2. Still, above the 1.5 default, slow structure dominates and the regime reads trending. Near or below 1.0, bar-to-bar noise dominates. Thus, it grades market character, not the odds of any trade.

Why did a clean cross of the line print no flag?

Four gates can block it. Hence, the regime may have read mixed, the scale-8 coefficient may have pointed the other way, the 4-bar cooldown may still be running, or the position state already held that direction. The dashboard shows regime and bars since the last signal, so you can see which gate applied.

How much should I rely on this indicator?

Treat it as one input, not a decision. Next, it is a chart analysis tool, not trading advice. Test it on your own markets and timeframes before relying on it. Results are not guaranteed; past performance is not indicative of future results.

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

Leave a Comment