Explainers / WaveTrend Oscillator [WT] by LazyBear
WaveTrend Oscillator [WT] by LazyBear, explained from the source
WaveTrend Oscillator [WT] is an open-source TradingView indicator by LazyBear with about 62,000 boosts, one of the most used scripts on the platform. It draws a green line, a dotted red line, a blue shaded area and four level lines. This page walks through the published code in order, says what each part really does, and ends with where it fails. It does not say whether the indicator makes money, and it gives no trades.
The surprise: it is a channel index smoothed twice, and its levels are fixed numbers
The name suggests something exotic. The code is short and familiar. It takes the typical price of each bar, subtracts an average of that price, and divides by 0.015 times the average size of that gap. That is the recipe of the Commodity Channel Index, built with exponential averages in place of simple ones. The result is then smoothed again over 21 bars. That smoothed value is the green line.
The scale has no top or bottom. The 60, 53, -53 and -60 lines are plain numbers typed into the settings. Nothing in the code works them out from the chart you are on.
Step 1: the price
The typical price: high plus low plus close, divided by three. You cannot change this in the settings.
Step 2: the channel index
An exponential average of that price over 10 bars ("Channel Length"), then an exponential average of how far price sits from it, also over 10 bars. The gap divided by 0.015 times that average distance gives the raw index.
Step 3: the two lines
The green line is a 21-bar exponential average of the raw index ("Average Length"). The red dotted line is a simple average of the green line over 4 bars. The 4 is written into the code and has no setting. The blue area is the green line minus the red one.
Step 4: what is not in the code
No dots, arrows or labels where the lines cross. No alert conditions. No test of whether a cross happened above or below a level. Everything a user does with this script, they do by eye.
What we checked in Python
We ported the logic to Python and ran it on invented random-walk prices with a typical move of 1% a bar, each bar built from 10 smaller steps: 40 runs of 5,000 bars, the first 300 of each run left out.
How often the green line is past a level. On random prices the green line was beyond 60 or -60 on 10.9% of bars, and beyond 53 or -53 on 20.3%. So about one bar in five sits in a marked zone on prices with nothing to find. The largest reading in a run was a median of 82.
How often the lines cross. A median of 702 crosses per 4,700 bars, about one bar in seven, with a median of 5 bars from one cross to the next. Of 28,244 crosses, 21,482 (76%) happened between the -53 and 53 lines, outside any marked zone.
The live bar flickers. Both lines use the current price until the bar closes. For every 10 crosses that held at the close, about 3 more showed inside a bar and were gone by its close (9,412 against 28,250). With finer steps inside each bar that count rose to about 4.
These figures describe the code on invented data, not any market.
Where it fails
- The levels are not measured. 60 and 53 are typed-in numbers on a scale with no limit. On random prices the line is past 53 about one bar in five.
- Crosses are frequent and mostly mid-range. About one bar in seven on random prices, three in four of them between the bands.
- The signal line cannot be tuned. The 4-bar average is fixed in the code.
- The price cannot be changed. It is always the typical price.
- A flat market breaks the division. If price does not move for a stretch, the average distance reaches zero and the index has nothing to divide by.
- The live bar can show a cross that disappears. About 3 vanished for every 10 that held in our port.
- No alerts and no marks. The code plots lines only.
- No length limits. The two lengths accept any number, including ones that make no sense.
The version with dots on every cross is covered on our WaveTrend with Crosses page.
Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. WaveTrend Oscillator [WT] is by LazyBear on TradingView; this page describes its published open-source code in our own words and is not affiliated with the author. Simulation figures come from synthetic random-walk prices and say nothing about how the script behaves on any market.
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, WaveTrend Oscillator, 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, Volume Flow Indicator by LazyBear, FVG Order Blocks by BigBeluga, CM_Williams_Vix_Fix by ChrisMoody, Bollinger + RSI Double Strategy by Chart, Ultimate Moving Average MTF by ChrisMood, Fibonacci Bollinger Bands by Rashad, Candlestick Patterns Identified by repo3, MACD + SMA 200 Strategy by ChartArt, Pine Script v5 to v6, Moving Average Cross Alert, Multi-Timefr, WaveTrend with Crosses [LazyBear], CM_Price-Action-Bars by ChrisMoody, RSI Candles by glaz, CM RSI-2 Strategy Lower Indicator by Chr, CM Stochastic Multi-TimeFrame by ChrisMo, CM_Ultimate RSI Multi Time Frame by Chri, TonyUX EMA Scalper - Buy / Sell by tux, MACD 4C by vkno422, My Pine Script is valid. What did the va
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.