Explainers / WaveTrend Oscillator
WaveTrend Oscillator, explained from its source
LazyBear's WaveTrend Oscillator is one of the most-boosted free indicators on TradingView, and dozens of popular scripts are built on top of it. It draws two wavy lines between overbought and oversold bands, and people trade the crosses. This page explains it from the published source code. The short version: WaveTrend is, in effect, a smoothed Commodity Channel Index.
The formula
Everything starts from the typical price, the average of high, low and close.
- Take a 10-bar EMA of the typical price.
- Measure how far price is from that EMA, and take a 10-bar EMA of that distance (always positive).
- Divide the first gap by 0.015 times the average distance.
- Smooth the result with a 21-bar EMA. That is the main line (WT1).
- Take a 4-bar simple average of WT1. That is the signal line (WT2).
ci = (hlc3 - EMA10) / (0.015 x EMA10 of |hlc3 - EMA10|), then WT1 = EMA21(ci) and WT2 = SMA4(WT1)
The shaded area is the gap between the two lines, WT1 minus WT2.
Why it is really a CCI
The Commodity Channel Index is the typical price minus its average, divided by 0.015 times the average deviation. Step 3 above is the same calculation with exponential averages in place of simple ones, and the same 0.015 constant. WaveTrend then smooths that CCI-like value with a 21-bar EMA.
Two things follow:
- It reacts like a slow CCI. If you already use CCI, WaveTrend will mostly tell you the same story, later and smoother.
- It is scaled by volatility. Because it divides by the average deviation, a quiet market and a wild one produce lines of the same size. That is why one set of levels works on any chart, and also why those levels say nothing about how far price has moved in money terms.
What the 60 and 53 levels mean
They are fixed lines the author chose, not a statistic of your chart. Because the value is scaled by volatility, the line reaches them often, even when nothing is happening.
In a simulation on pure random-walk prices (200,000 bars, nothing to predict), the main line spent about 1 bar in 9 beyond plus or minus 60, and about 1 in 5 beyond plus or minus 53. Making the simulated volatility jump between calm and wild periods barely changed those numbers.
So "overbought" on WaveTrend means "recent prices are high relative to their own recent average and wiggle", not "price is about to fall". Treat a reading beyond 60 as common, not rare.
The crosses
The "WaveTrend with Crosses" version marks every point where the two lines cross. In the same random-walk simulation the lines crossed about once every 7 bars, and roughly 1 cross in 7 happened beyond the 60 levels. A cross is a 4-bar average catching up with the line it averages. It happens constantly by construction, so any filter you add matters far more than the cross itself.
Does WaveTrend repaint?
Not on closed bars. It uses only the current and past bars: no higher-timeframe request, no future data, no offset.
The live bar does change. Until the bar closes, the typical price moves with every tick, so both lines move and a cross can appear and then vanish. The "with Crosses" version draws its circles and bar colours with no check for a closed bar, so a marker you see mid-bar may not be there at the close. For the full picture see what repainting is, or paste a script into the repaint checker.
Settings, honestly
- Channel Length (10): the EMA used for the centre line and for the average distance. Shorter makes the raw CCI jumpier.
- Average Length (21): the smoothing of the main line. This is the main lag control. Longer means smoother lines, fewer crosses and later turns.
- The 4-bar signal line is fixed in the original; it is not an input.
- Levels (60, 53, -53, -60): drawing only. Changing them does not change the lines, just where you decide "extreme" starts.
There is no best setting. A shorter average gives earlier turns and more false crosses; a longer one gives fewer crosses and more lag. That trade-off does not go away.
WaveTrend vs RSI
RSI compares average up-moves with average down-moves and is bounded between 0 and 100. WaveTrend measures distance from an average, scaled by volatility, and has no fixed bounds. Both are momentum oscillators built from smoothed price changes, so on most charts they turn at similar times. See the RSI explainer.
The audit version on TradingView
We rewrote WaveTrend from scratch and published it free and open source: Taught to Trade - WaveTrend Audit. At the default settings it computes the same two lines as LazyBear's original. It adds what the original leaves out: a cross is marked only once the bar has closed (a cross on the still-open bar shows as a grey pending dot), and a panel counts, on your own chart, how often the line sits beyond each level, how many times the two lines cross and the median number of bars between crosses.
Where it fails
- Trends. In a strong trend the line can sit beyond 60 for a long time. "Overbought" is not a reason for a trend to end.
- Noise. Crosses happen about every 7 bars even on random data. Most of them mean nothing.
- Lag. Three layers of averaging (10, 21 and 4 bars) mean turns show up after price has already turned.
- The live bar. Crosses and bar colours can appear and disappear before the bar closes.
- It is a description, not a forecast. It tells you where price sits relative to its own recent average. It does not tell you what happens next.
Also explained
Educational content only. Not financial advice. Nothing here is a recommendation to buy or sell anything. Original script by LazyBear on TradingView; this page explains its published source and quotes no code.
Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, Chandelier Exit, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, HalfTrend, ZigZag++, SSL Hybrid, CM MacD Ultimate MTF, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Order Block Finder, Pivot Point SuperTrend, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Support and Resistance (High Volume Boxe, Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue
Get the next teardown by email
One short email when a new teardown or free tool goes live, about twice a month. No signals, no hype. Unsubscribe in one click.
Almost done. Check your inbox and click the confirmation link.
Sent with Kit. Your address is used only for these emails. Privacy
No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.