OPEN-SOURCE SCRIPT
Zaktualizowano Adaptive Pivot-Length WaveTrend

Adaptive Pivot-Length WaveTrend (APL-WT)
A self-tuning WaveTrend oscillator that derives its smoothing lengths from the market’s own dominant cycle rather than fixed user inputs. A multi-scale pivot engine sweeps pivot strengths from 14 to 100 bars, building a probability mass function (PMF) over pivot-to-pivot distances. The mode of that distribution — the statistically dominant cycle length L — drives both WaveTrend lengths: n2 = L (average) and n1 = round(L × ratio) (channel), with floors, ceilings, and a stickiness tolerance to prevent jitter.
Because length adapts bar-to-bar, WaveTrend’s EMA state is carried manually to stay stable when periods change. Overbought, oversold, and mid-band levels are not hardcoded — they’re computed as empirical percentiles of WT1’s own recent distribution (default: 95/80/50/20/5 over 2000 bars), so the thresholds self-calibrate to each instrument and timeframe.
Signals
• Bullish/bearish WT1/WT2 crosses gated by the adaptive OS/OB percentile levels
• Mid-line cross alerts
• Full regular and hidden divergence suite (bull, bear, hidden bull, hidden bear) with pivot lookback controls, gated by the ±50 zones on WT1
Readouts
Optional info table showing dominant L, active n1/n2, cumulative pivot sample count, live WT1/WT2 values, WT1’s self-percentile rank, current OB/OS levels, regime state (OB / Upper / Mid / Lower / OS), and WT1-vs-WT2 polarity. Optional bar coloring in OB/OS extremes.
Best suited for traders who want WaveTrend to respect the actual cycle structure of whatever they’re looking at, without manually tuning lengths per symbol or timeframe.
A self-tuning WaveTrend oscillator that derives its smoothing lengths from the market’s own dominant cycle rather than fixed user inputs. A multi-scale pivot engine sweeps pivot strengths from 14 to 100 bars, building a probability mass function (PMF) over pivot-to-pivot distances. The mode of that distribution — the statistically dominant cycle length L — drives both WaveTrend lengths: n2 = L (average) and n1 = round(L × ratio) (channel), with floors, ceilings, and a stickiness tolerance to prevent jitter.
Because length adapts bar-to-bar, WaveTrend’s EMA state is carried manually to stay stable when periods change. Overbought, oversold, and mid-band levels are not hardcoded — they’re computed as empirical percentiles of WT1’s own recent distribution (default: 95/80/50/20/5 over 2000 bars), so the thresholds self-calibrate to each instrument and timeframe.
Signals
• Bullish/bearish WT1/WT2 crosses gated by the adaptive OS/OB percentile levels
• Mid-line cross alerts
• Full regular and hidden divergence suite (bull, bear, hidden bull, hidden bear) with pivot lookback controls, gated by the ±50 zones on WT1
Readouts
Optional info table showing dominant L, active n1/n2, cumulative pivot sample count, live WT1/WT2 values, WT1’s self-percentile rank, current OB/OS levels, regime state (OB / Upper / Mid / Lower / OS), and WT1-vs-WT2 polarity. Optional bar coloring in OB/OS extremes.
Best suited for traders who want WaveTrend to respect the actual cycle structure of whatever they’re looking at, without manually tuning lengths per symbol or timeframe.
Informacje o Wersji
Updated the divergence length Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.