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. اقرأ المزيد في شروط الاستخدام.