Complete Suite: all 12 tools. 6 Premium desks inside.All 12 tools $606.98 one by one

$606.98 one by one $97 once Save $509.98Get the SuiteGet it
ProEA Lab · MT5, TradingView and trading research · Evidence standards
Indicators

WaveTrend Oscillator Settings: LazyBear & VuManChu Cipher B Code, Read Line by Line

What Channel Length, Average Length, Signal SMA and the ±53 / ±60 bands actually compute inside LazyBear's 61,565-boost WaveTrend and VuManChu Cipher B — including line 18's zero-division trap, line 193's volume-free 'VWAP' wave, and a clean Pine Script v6 build.

PL · 10 min readUpdated
Explainer cover titled WaveTrend settings, read from the code. Two-pane chart over 60 simulated 15-minute candles comparing LazyBear's 10/21/4 WaveTrend oscillator against VuManChu Cipher B's faster 9/12/3 settings and yellow wt1 minus wt2 spread histogram.
Links to TradingView in this article are partner links: if you open a new TradingView account through one and buy a plan, TradingView may pay ProEA a commission, at no cost to you.

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:

Compare LazyBear WaveTrend (10 · 21 · 4) against VuManChu Cipher B (9 · 12 · 3) and Extreme Zone Filtering60 simulated 15-minute candles showing wt1, wt2, line 193's yellow wt1 - wt2 spread wave, and 2-bar confirmed fractal divergences.
Simulated 15m Price · Markers show active WaveTrend cross dots on closed barsWaveTrend: Teal = wt1 · Navy = wt2 · Gold bars = wt1 - wt2 ("wtVwap" spread) · ±53 bands+530-53DIV+2b
Try a preset
Dot filter & wave

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 PresetRaw CrossesPlotted DotsWhipsaws (≤3b)2-Bar Divergences
LazyBear Default (10 · 21 · 4 · Extreme ±53)31▲ / 1▼01
VuManChu Cipher B (9 · 12 · 3 · All Crosses)74▲ / 3▼21
Cipher B Filtered (9 · 12 · 3 · Extreme ±53)72▲ / 1▼01
Slow Swing (14 · 28 · 4 · Extreme ±60)30▲ / 0▼01

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:

  1. Why ±53 and ±60? Line 18 divides by Lambert's 0.015 constant (1 / 0.015 = 66.67). Because d is an exponential mean absolute deviation, bars where |hlc3 - esa| equals 0.80 × d to 0.90 × d land right at ±53.3 to ±60.0. Nothing in the formula caps wt1 (on the drill's simulated candles Cipher B's |wt1| peaks at 78.1), so WaveTrend has no fixed 0–100 range the way RSI does.
  2. Line 22 hardcodes the 4-bar signal SMA. LazyBear exposes n1 = input(10, "Channel Length") and n2 = input(21, "Average Length"), then writes wt2 = sma(wt1, 4) as a literal 4 on line 22. You cannot tune wt2 in LazyBear's original without editing the code.
  3. Line 18 has no zero-division guard. On illiquid overnight CFD bars, halted stocks or synthetic ratio charts where four consecutive bars print identical hlc3, d approaches 0 and (ap - esa) / (0.015 * d) evaluates to na — poisoning the recursive ema(ci, n2) state until guarded with d == 0 ? 0.0 : ... or nz().

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 behaviorLazyBear WaveTrend [LazyBear] (2KE8wTuF)VuManChu Cipher B + Divergences (Msm4SjwI)Practical impact on live charts
Smoothing lengthsn1 = 10, n2 = 21, hardcoded SMA = 4Lines 49–52: wtChannelLen = 9, wtAverageLen = 12, wtMALen = 3A 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 labelsobLevel1 = 60 (outer), obLevel2 = 53 (inner)Lines 53–58: obLevel = 53, obLevel2 = 60, obLevel3 = 100Same 53 and 60 numbers, opposite input variable names
Yellow "Fast WT / VWAP" waveNot present (wt1 - wt2 plotted only as tiny blue bars)Line 193: wtVwap = wt1 - wt2Contains zero volume — it is simply the oscillator momentum histogram (wt1 minus wt2), not session VWAP
Fractal divergence lag & boundsNoneLines 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 DiamondsNoneLines 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 & TimeframeChannel (n1)Average (n2)Signal SMA (maLen)Dot FilterA pairing to test
5m / 15m Session Scalping9123Only crosses beyond ±53Trade bull dots only above RTH Session VWAP, bear dots below
15m / 1H Intraday Pullbacks10214Only crosses beyond ±53A directional SuperTrend 10 × 3 filter, which skips bull dots while SuperTrend points down
1H / 4H Swing Reversals14284Only crosses beyond ±60 + 2-bar divergenceRequire confirmed price-vs-wt2 divergence or volatility compression from Squeeze Momentum settings
Machine Learning Feature Input1011—Continuous feature vectorMatches 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's 10 / 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.

Continue reading

Best Scalping Indicators on TradingView (2026), 7 Scripts Code-Read

We read seven popular open-source TradingView scalping scripts line by line, and list one invite-only script whose code we couldn't see: hidden Heikin Ashi triggers, unused stopLoss variables, unshifted higher-timeframe security() leaks, linear regression dressed up as AI, and a clean Pine Script v6 pullback scalper.

Nov 11 · ProEA Lab

Scorecard cover titled Best scalping indicators, code-read. Comparison table across six popular TradingView scalping scripts checking real OHLC candle math, barstate.isconfirmed locking, and real ATR risk levels.

Pine Script to MQL4: Converting a TradingView Indicator or Strategy to MT4 (.mq4)

Free in-browser Pine Script to MQL4 converter and MT4 guide: draft a #property strict .mq4 indicator or EA, map shift=1 iMA/iATR calls, gate Time[0], and audit OrderSend tickets.

Nov 11 · ProEA Lab

Explainer cover titled Pine Script to MQL4, shift by shift: side-by-side mapping comparing TradingView Pine v6 series calls against MetaTrader 4 #property strict iMA/iATR shift 1 calls and OrderClose + OrderSend ticket management.

Best Engulfing Candle Indicators on TradingView (2026), Code-Read.

We read the code of the 16 most-boosted open-source engulfing candle scripts on TradingView, and TradingView's own: which test the body and which the range, which need opposite colours, a bigger body, a trend or volume, and which mark the candle before it has closed.

Oct 31 · ProEA Lab

Explainer cover titled Best engulfing candle indicators, code-read: a table of the six most-boosted open-source TradingView engulfing scripts with ticks, crosses and halves for three checks: whether the new body covers the last body, whether the two candles must be opposite colours, and whether the script waits for the candle to close.