LazyBear's WaveTrend Oscillator is an EMA-normalized Commodity Channel Index (n1 = 10, n2 = 21, plus a hardcoded 4-bar SMA signal line) bounded empirically around ±53 and ±60, whereas VuManChu Cipher B (9 / 12 / 3) cuts the second smoothing period nearly in half and plots wt1 - wt2 as a yellow histogram mislabelled "VWAP". We haven't tested either on real markets, so neither is "better" here: 9 / 12 / 3 turns sooner, and on the drill's 60 simulated candles 10 / 21 / 4 gated outside ±53 printed no mid-band whipsaws. That is an illustration, not a result.
On 11 November 2026 we read the Pine source of WaveTrend scripts from TradingView's script search, among them LazyBear's Indicator: WaveTrend Oscillator [WT] (2KE8wTuF, 61,565 boosts, 32 lines), vumanchu's VuManChu Cipher B + Divergences (Msm4SjwI, 24,963 boosts, 524 lines), lonestar108's WaveTrend with Crosses [LazyBear] (jFQn4jYZ, 23,761 boosts, 35 lines) and jdehorty's WaveTrend 3D (clUzC70G, 4,418 boosts). Below is every line that moves your signals, an interactive drill comparing the presets, and a clean //@version=6 implementation that fixes the silent bugs in the legacy v2/v4 originals.
Interactive drill: LazyBear 10 / 21 / 4 vs VuManChu Cipher B 9 / 12 / 3
Switch between LazyBear Default (10 · 21 · 4), VuManChu Cipher B (9 · 12 · 3), and Slow Swing (14 · 28 · 4) below, or toggle Extreme Zone Only (|wt2| >= 53) vs Every wt1 / wt2 Cross to see how mid-band chop multiplies false dots:
n1=10 · n2=21 · SMA=4: 1 bull & 1 bear active dots (3 total crosses)
0 whipsaws within 3 bars, 1 confirmed 2-bar fractal divergences, peak |wt1| = 65.7.
Simulated 15-minute candles, not market data: generated deterministically (28 warmup + 60 visible bars) to illustrate LazyBear's 2KE8wTuF (32 lines, 61,565 boosts) and VuManChu's Msm4SjwI (524 lines, 24,963 boosts), read 11 November 2026. Counts describe these simulated bars only; no trade outcomes are claimed.
Drill code: our TypeScript port of Indicator: WaveTrend Oscillator [WT] by LazyBear, used under the Mozilla Public License 2.0. Its source: open-source code on ProEA.
Read preset comparison as table
| WaveTrend Preset | Raw Crosses | Plotted Dots | Whipsaws (≤3b) | 2-Bar Divergences |
|---|---|---|---|---|
| LazyBear Default (10 · 21 · 4 · Extreme ±53) | 3 | 1▲ / 1▼ | 0 | 1 |
| VuManChu Cipher B (9 · 12 · 3 · All Crosses) | 7 | 4▲ / 3▼ | 2 | 1 |
| Cipher B Filtered (9 · 12 · 3 · Extreme ±53) | 7 | 2▲ / 1▼ | 0 | 1 |
| Slow Swing (14 · 28 · 4 · Extreme ±60) | 3 | 0▲ / 0▼ | 0 | 1 |
Across those exact 60 simulated 15-minute candles, LazyBear Default (10 · 21 · 4, Extreme ±53) prints 3 raw wt1 / wt2 crosses, 2 plotted dots (1 bull, 1 bear), and 0 mid-band whipsaws (|wt1| peaks at 65.7). Switching to VuManChu Cipher B (9 · 12 · 3, All Crosses) jumps to 7 raw crosses, 7 plotted dots (4 bull, 3 bear), and 2 whipsaws inside 3 bars (|wt1| peaks at 78.1), whereas Cipher B Filtered (9 · 12 · 3, Extreme ±53) keeps the faster turn speed while cutting plotted dots to 3 (0 whipsaws), and Slow Swing (14 · 28 · 4, Extreme ±60) suppresses all 3 raw crosses (0 dots, since peak |wt1| = 58.1 stays inside ±60) until a 2-bar pivot divergence confirms.
The WaveTrend formula, read line by line from LazyBear's 2KE8wTuF
LazyBear's original WT_LB (32 lines of Pine v1/v2, 61,565 boosts) adapts Thomas Stridsman's and Donald Lambert's CCI normalization by replacing simple moving averages and mean deviations with exponential moving averages (ema) on typical price (hlc3 = (high + low + close) / 3):
ap = hlc3 = (high + low + close) / 3
esa = EMA(ap, n1)
d = EMA(abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
wt1 = EMA(ci, n2)
wt2 = SMA(wt1, 4)
Three code details inside 2KE8wTuF surprise traders who only look at the Settings dialog:
- Why
±53and±60? Line18divides by Lambert's0.015constant (1 / 0.015 = 66.67). Becausedis an exponential mean absolute deviation, bars where|hlc3 - esa|equals0.80 × dto0.90 × dland right at±53.3to±60.0. Nothing in the formula capswt1(on the drill's simulated candles Cipher B's|wt1|peaks at78.1), so WaveTrend has no fixed0–100range the way RSI does. - Line
22hardcodes the4-bar signal SMA. LazyBear exposesn1 = input(10, "Channel Length")andn2 = input(21, "Average Length"), then writeswt2 = sma(wt1, 4)as a literal4on line22. You cannot tunewt2in LazyBear's original without editing the code. - Line
18has no zero-division guard. On illiquid overnight CFD bars, halted stocks or synthetic ratio charts where four consecutive bars print identicalhlc3,dapproaches0and(ap - esa) / (0.015 * d)evaluates tona— poisoning the recursiveema(ci, n2)state until guarded withd == 0 ? 0.0 : ...ornz().
What VuManChu Cipher B (Msm4SjwI, 24,963 boosts) actually changes
VuManChu Cipher B became famous as the open-source recreation of Market Cipher B. Reading its 524 lines side by side against LazyBear's 32 lines reveals four concrete differences:
| Code behavior | LazyBear WaveTrend [LazyBear] (2KE8wTuF) | VuManChu Cipher B + Divergences (Msm4SjwI) | Practical impact on live charts |
|---|---|---|---|
| Smoothing lengths | n1 = 10, n2 = 21, hardcoded SMA = 4 | Lines 49–52: wtChannelLen = 9, wtAverageLen = 12, wtMALen = 3 | A second EMA 43% shorter (12 vs 21), so wt1 turns sooner; on the drill's 60 simulated candles, 7 raw crosses against LazyBear's 3 (not measured on real markets) |
| Overbought / Oversold labels | obLevel1 = 60 (outer), obLevel2 = 53 (inner) | Lines 53–58: obLevel = 53, obLevel2 = 60, obLevel3 = 100 | Same 53 and 60 numbers, opposite input variable names |
Yellow "Fast WT / VWAP" wave | Not present (wt1 - wt2 plotted only as tiny blue bars) | Line 193: wtVwap = wt1 - wt2 | Contains zero volume — it is simply the oscillator momentum histogram (wt1 minus wt2), not session VWAP |
| Fractal divergence lag & bounds | None | Lines 67–68, 165–175: 5-bar fractal centered on src[2] with asymmetric defaults (+45 OB / -65 OS) | Every regular or hidden divergence dot confirms 2 closed bars after the swing high or low |
| Higher-timeframe Sommi Diamonds | None | Lines 254–257 (f_getTFCandle): security(heikinashi(...), _tf, close, barmerge.gaps_off, barmerge.lookahead_on) | Historical lookahead leak: lookahead_on without [1] reads finished 1H/3H Heikin Ashi bars before they close! |
WaveTrend starting settings by timeframe (untested)
We haven't tested any row of this table on real markets: these are presets to start testing from, not results. Because n1 sets the volatility baseline (d) and n2 smooths the normalized distance (ci), changing n2 moves cross timing more than changing n1:
| Style & Timeframe | Channel (n1) | Average (n2) | Signal SMA (maLen) | Dot Filter | A pairing to test |
|---|---|---|---|---|---|
| 5m / 15m Session Scalping | 9 | 12 | 3 | Only crosses beyond ±53 | Trade bull dots only above RTH Session VWAP, bear dots below |
| 15m / 1H Intraday Pullbacks | 10 | 21 | 4 | Only crosses beyond ±53 | A directional SuperTrend 10 × 3 filter, which skips bull dots while SuperTrend points down |
| 1H / 4H Swing Reversals | 14 | 28 | 4 | Only crosses beyond ±60 + 2-bar divergence | Require confirmed price-vs-wt2 divergence or volatility compression from Squeeze Momentum settings |
| Machine Learning Feature Input | 10 | 11 | — | Continuous feature vector | Matches f_wavetrend(10, 11) used inside jdehorty's Lorentzian Classification indicator settings |
Clean, non-repainting WaveTrend + Confirmed Divergence in Pine Script v6
This standalone //@version=6 script exposes maLen, guards line 18 against d == 0 flat-bar division, plots the optional wt1 - wt2 momentum wave honestly as WT Spread, marks confirmed 2-bar divergences at the exact confirmation bar (without back-painting tricks that hide entry lag), and gates alerts on barstate.isconfirmed:
//@version=6
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © LazyBear: the WaveTrend calculation (ap, esa, d, ci, wt1, wt2) of "Indicator: WaveTrend Oscillator [WT]", https://www.tradingview.com/script/2KE8wTuF/
// Modified by ProEA, 2026: Pine Script v6, a zero-division guard, an adjustable signal length, closed-bar dots, pivot divergences and alerts.
indicator("ProEA WaveTrend v6 (Zero-Guarded + Confirmed Dots)", shorttitle = "WT v6 Clean", overlay = false)
int n1 = input.int(10, "Channel Length (n1)", minval = 2)
int n2 = input.int(21, "Average Length (n2)", minval = 2)
int maLen = input.int(4, "Signal SMA Length (wt2)", minval = 2)
float obOuter = input.float(60.0, "Outer Overbought Level")
float obInner = input.float(53.0, "Inner Trigger Level (±)")
bool extremeOnly = input.bool(true, "Plot Cross Dots Only Beyond ±Trigger")
bool showSpread = input.bool(true, "Show WT1 - WT2 Momentum Histogram")
int pivRight = input.int(2, "Divergence Confirmation Bars (Right)", minval = 1, maxval = 10)
float ap = hlc3
float esa = ta.ema(ap, n1)
float d = ta.ema(math.abs(ap - esa), n1)
float ci = d <= 1e-9 ? 0.0 : (ap - esa) / (0.015 * d)
float wt1 = ta.ema(ci, n2)
float wt2 = ta.sma(wt1, maLen)
float spread = wt1 - wt2
bool rawBull = ta.crossover(wt1, wt2)
bool rawBear = ta.crossunder(wt1, wt2)
bool bullDot = extremeOnly ? (rawBull and wt2 <= -obInner) : rawBull
bool bearDot = extremeOnly ? (rawBear and wt2 >= obInner) : rawBear
// Confirmed pivot divergences on wt2 (fires pivRight closed bars after pivot, zero lookahead)
float divExtreme = math.max(30.0, obInner - 15.0)
float plWt = ta.pivotlow(wt2, 2, pivRight)
float phWt = ta.pivothigh(wt2, 2, pivRight)
var float prevPlWt = na
var float prevPlLow = na
var float prevPhWt = na
var float prevPhHi = na
bool bullDiv = false
if not na(plWt) and barstate.isconfirmed
float curLow = low[pivRight]
bullDiv := not na(prevPlWt) and curLow < prevPlLow and plWt > prevPlWt and plWt <= -divExtreme
prevPlWt := plWt
prevPlLow := curLow
bool bearDiv = false
if not na(phWt) and barstate.isconfirmed
float curHi = high[pivRight]
bearDiv := not na(prevPhWt) and curHi > prevPhHi and phWt < prevPhWt and phWt >= divExtreme
prevPhWt := phWt
prevPhHi := curHi
hline(0, "Zero", color = color.new(color.gray, 60))
hline(obOuter, "OB Outer", color = color.new(#ef5350, 45))
hline(obInner, "OB Trigger", color = color.new(#ef5350, 65), linestyle = hline.style_dashed)
hline(-obInner, "OS Trigger", color = color.new(#26a69a, 65), linestyle = hline.style_dashed)
hline(-obOuter, "OS Outer", color = color.new(#26a69a, 45))
plot(showSpread ? spread : na, "WT Spread (wt1 - wt2)", style = plot.style_area, color = color.new(#eab308, 72))
p1 = plot(wt1, "WT1", color = #0d9488, linewidth = 2)
p2 = plot(wt2, "WT2", color = #ef5350, linewidth = 1)
fill(p1, p2, color = wt1 >= wt2 ? color.new(#0d9488, 82) : color.new(#ef5350, 82), title = "WT Ribbon")
bool bullCrossNow = bullDot and barstate.isconfirmed
bool bearCrossNow = bearDot and barstate.isconfirmed
bool bullDivNow = bullDiv and barstate.isconfirmed
bool bearDivNow = bearDiv and barstate.isconfirmed
plot(bullCrossNow ? wt2 : na, "Confirmed Bull Dot", color = #089981, style = plot.style_circles, linewidth = 4)
plot(bearCrossNow ? wt2 : na, "Confirmed Bear Dot", color = #ef5350, style = plot.style_circles, linewidth = 4)
plotshape(bullDivNow, "Confirmed Bull Div", shape.labelup, location.bottom, #089981, text = "DIV", textcolor = color.white, size = size.tiny)
plotshape(bearDivNow, "Confirmed Bear Div", shape.labeldown, location.top, #ef5350, text = "DIV", textcolor = color.white, size = size.tiny)
alertcondition(bullCrossNow, "WaveTrend Bull Cross (Confirmed)", "Confirmed WaveTrend bullish cross")
alertcondition(bearCrossNow, "WaveTrend Bear Cross (Confirmed)", "Confirmed WaveTrend bearish cross")
alertcondition(bullDivNow, "WaveTrend Bullish Divergence (Confirmed)", "Confirmed WaveTrend bullish pivot divergence")
alertcondition(bearDivNow, "WaveTrend Bearish Divergence (Confirmed)", "Confirmed WaveTrend bearish pivot divergence")
Based on the WaveTrend calculation in Indicator: WaveTrend Oscillator [WT] by LazyBear (MPL-2.0). Our changes: Pine Script v6, a guard against division by zero, an adjustable signal length, dots and pivot divergences on closed bars, and alerts. The drill above runs our TypeScript port of the same calculation, also MPL-2.0: its source.
If you want to merge this WaveTrend pane with an overlay EMA ribbon or session box inside TradingView's free 2-indicator limit, combine them in our Pine Script indicator merger, or generate an MT5/MT4 draft directly in our Pine Script to MQL5 converter.
LazyBear's10 / 21 / 4 and Cipher B's 9 / 12 / 3 are defaults, not tested settings: treat Cipher B's yellow wave as wt1 - wt2 momentum rather than volume, trigger alerts only on barstate.isconfirmed, and test any dot filter, such as ignoring crosses inside ±53, on your own market before you trust it.Use this animation on your site.
Frequently asked questions
What are the default WaveTrend Oscillator settings on TradingView?
LazyBear's original WaveTrend script (61,565 boosts) defaults to Channel Length 10, Average Length 21, a hardcoded 4-bar simple moving average for the wt2 signal line, and overbought/oversold reference bands at plus or minus 60 and plus or minus 53.
Why does VuManChu Cipher B cross earlier than LazyBear's WaveTrend?
Lines 49 to 52 of VuManChu Cipher B tighten the defaults from 10, 21 and 4 down to Channel Length 9, Average Length 12 and Signal SMA 3. Cutting the second EMA nearly in half makes wt1 turn earlier on reversals and cross wt2 more often: on the drill's 60 simulated candles, 7 raw crosses against LazyBear's 3. We haven't measured it on real markets.
Does the yellow VWAP line in VuManChu Cipher B use trading volume?
No. Line 193 of VuManChu Cipher B defines wtVwap = wt1 - wt2, which is purely the arithmetic spread between the fast WaveTrend line and its 3-bar moving average. Trading volume never enters the calculation.
Does the WaveTrend Oscillator repaint?
Standard wt1 and wt2 values use causal EMA and SMA math on hlc3 and lock permanently once a candle closes, though unconfirmed cross dots can appear and disappear while the live bar is still forming. However, VuManChu Cipher B's optional Sommi Diamond higher-timeframe filter calls security() on Heikin Ashi candles with barmerge.lookahead_on and no [1] offset on lines 254 to 257, which leaks future higher-timeframe closes on historical bars.
What is the WaveTrend formula?
WaveTrend is an EMA-smoothed cousin of Donald Lambert's Commodity Channel Index: compute typical price ap = hlc3, smooth esa = ema(ap, n1) and mean absolute deviation d = ema(abs(ap - esa), n1), normalize ci = (ap - esa) / (0.015 * d), smooth wt1 = ema(ci, n2), and take wt2 = sma(wt1, maLen).
Which WaveTrend settings should I use for scalping or swing trading?
We haven't tested any WaveTrend setting on real markets, so we name none as best. The drill compares three presets on 60 simulated candles: LazyBear's 10, 21 and 4, Cipher B's 9, 12 and 3, and a slower 14, 28 and 4 with crosses counted only beyond plus or minus 60. That shows what each setting does, not what it earns: test any of them, and any dot filter beyond plus or minus 53, on your own market first.



