OPEN-SOURCE SCRIPT
Обновлено 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.
Информация о релизе
Updated the divergence length Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.