Выбор редакции
OPEN-SOURCE SCRIPT

WaveTrend 3D

Обновлено
█ OVERVIEW

WaveTrend 3D (WT3D) is a novel implementation of the famous WaveTrend (WT) indicator and has been completely redesigned from the ground up to address some of the inherent shortcomings associated with the traditional WT algorithm.

█ BACKGROUND

The WaveTrend (WT) indicator has become a widely popular tool for traders in recent years. WT was first ported to PineScript in 2014 by the user LazyBear, and since then, it has ascended to become one of the Top 5 most popular scripts on TradingView.

The WT algorithm appears to have origins in a lesser-known proprietary algorithm called Trading Channel Index (TCI), created by AIQ Systems in 1986 as an integral part of their commercial software suite, TradingExpert Pro. The software’s reference manual states that “TCI identifies changes in price direction” and is “an adaptation of Donald R. Lambert’s Commodity Channel Index (CCI)”, which was introduced to the world six years earlier in 1980. Interestingly, a vestige of this early beginning can still be seen in the source code of LazyBear’s script, where the final EMA calculation is stored in an intermediate variable called “tci” in the code.

Indicator: WaveTrend Oscillator [WT]


█ IMPLEMENTATION DETAILS

WaveTrend 3D is an alternative implementation of WaveTrend that directly addresses some of the known shortcomings of the indicator, including its unbounded extremes, susceptibility to whipsaw, and lack of insight into other timeframes.

In the canonical WT approach, an exponential moving average (EMA) for a given lookback window is used to assess the variability between price and two other EMAs relative to a second lookback window. Since the difference between the average price and its associated EMA is essentially unbounded, an arbitrary scaling factor of 0.015 is typically applied as a crude form of rescaling but still fails to capture 20-30% of values between the range of -100 to 100. Additionally, the trigger signal for the final EMA (i.e., TCI) crossover-based oscillator is a four-bar simple moving average (SMA), which further contributes to the net lag accumulated by the consecutive EMA calculations in the previous steps.

The core idea behind WT3D is to replace the EMA-based crossover system with modern Digital Signal Processing techniques. By assuming that price action adheres approximately to a Gaussian distribution, it is possible to sidestep the scaling nightmare associated with unbounded price differentials of the original WaveTrend method by focusing instead on the alteration of the underlying Probability Distribution Function (PDF) of the input series. Furthermore, using a signal processing filter such as a Butterworth Filter, we can eliminate the need for consecutive exponential moving averages along with the associated lag they bring.

Ideally, it is convenient to have the resulting probability distribution oscillate between the values of -1 and 1, with the zero line serving as a median. With this objective in mind, it is possible to borrow a common technique from the field of Machine Learning that uses a sigmoid-like activation function to transform our data set of interest. One such function is the hyperbolic tangent function (tanh), which is often used as an activation function in the hidden layers of neural networks due to its unique property of ensuring the values stay between -1 and 1. By taking the first-order derivative of our input series and normalizing it using the quadratic mean, the tanh function performs a high-quality redistribution of the input signal into the desired range of -1 to 1. Finally, using a dual-pole filter such as the Butterworth Filter popularized by John Ehlers, excessive market noise can be filtered out, leaving behind a crisp moving average with minimal lag.

Furthermore, WT3D expands upon the original functionality of WT by providing:
  • First-class support for multi-timeframe (MTF) analysis
  • Kernel-based regression for trend reversal confirmation
  • Various options for signal smoothing and transformation
  • A unique mode for visualizing an input series as a symmetrical, three-dimensional waveform useful for pattern identification and cycle-related analysis


█ SETTINGS

This is a summary of the settings used in the script listed in roughly the order in which they appear. By default, all default colors are from Google's TensorFlow framework and are considered to be colorblind safe.

  • Source: The input series. Usually, it is the close or average price, but it can be any series.
  • Use Mirror: Whether to display a mirror image of the source series; for visualizing the series as a 3D waveform similar to a soundwave.
  • Use EMA: Whether to use an exponential moving average of the input series.
  • EMA Length: The length of the exponential moving average.
  • Use COG: Whether to use the center of gravity of the input series.
  • COG Length: The length of the center of gravity.
  • Speed to Emphasize: The target speed to emphasize.
  • Width: The width of the emphasized line.
  • Display Kernel Moving Average: Whether to display the kernel moving average of the signal. Like PCA, an unsupervised Machine Learning technique whereby neighboring vectors are projected onto the Principal Component.
  • Display Kernel Signal: Whether to display the kernel estimator for the emphasized line. Like the Kernel MA, it can show underlying shifts in bias within a more significant trend by the colors reflected on the ribbon itself.
  • Show Oscillator Lines: Whether to show the oscillator lines.
  • Offset: The offset of the emphasized oscillator plots.
  • Fast Length: The length scale factor for the fast oscillator.
  • Fast Smoothing: The smoothing scale factor for the fast oscillator.
  • Normal Length: The length scale factor for the normal oscillator.
  • Normal Smoothing: The smoothing scale factor for the normal frequency.
  • Slow Length: The length scale factor for the slow oscillator.
  • Slow Smoothing: The smoothing scale factor for the slow frequency.
  • Divergence Threshold: The number of bars for the divergence to be considered significant.
  • Trigger Wave Percent Size: How big the current wave should be relative to the previous wave.
  • Background Area Transparency Factor: Transparency factor for the background area.
  • Foreground Area Transparency Factor: Transparency factor for the foreground area.
  • Background Line Transparency Factor: Transparency factor for the background line.
  • Foreground Line Transparency Factor: Transparency factor for the foreground line.
  • Custom Transparency: Transparency of the custom colors.
  • Total Gradient Steps: The maximum amount of steps supported for a gradient calculation is 256.
  • Fast Bullish Color: The color of the fast bullish line.
  • Normal Bullish Color: The color of the normal bullish line.
  • Slow Bullish Color: The color of the slow bullish line.
  • Fast Bearish Color: The color of the fast bearish line.
  • Normal Bearish Color: The color of the normal bearish line.
  • Slow Bearish Color: The color of the slow bearish line.
  • Bullish Divergence Signals: The color of the bullish divergence signals.
  • Bearish Divergence Signals: The color of the bearish divergence signals.


█ ACKNOWLEDGEMENTS

  • LazyBear - For authoring the original WaveTrend port on TradingView
  • PineCoders - For the beautiful color gradient framework used in this indicator
  • veryfid - For the inspiration of using mirrored signals for cycle analysis and using multiple lookback windows as proxies for other timeframes





Информация о релизе
  • Some minor code refactoring and reorganization for easier reading
  • A small change to allow oscillator lines to be optionally available in mirrored mode
  • Additional commentary regarding the use of Kernel Estimators
  • Additional commentary on the Kernel ribbon usage and its relation to PCA, an unsupervised Machine Learning technique
Информация о релизе
New Feature: Reversal Zones (Overbought/Oversold)
снимок

Implemented several popular requests based on user feedback, including:
  • Added additional information regarding how to use this indicator
  • Added additional alerts for median crossovers involving the normal and fast speed oscillators
  • Added an option to enable Reversal Zone Bands, which can be used to indicate overbought/oversold conditions.
  • Improved the handling of divergence distance (as a percentage of the previous wave) to be more intuitive and easier to use.
  • Improved organization of settings interface; changed the wording of various settings to be less confusing
Информация о релизе
  • Add option to invert the colors for the Overbought/Oversold zones.
  • The intensity of the overbought/oversold regions can also be used as a confirmation of trend strength.
Информация о релизе
Added a backtest stream for those wishing to use a Backtest Adapter
butterworthcipherbcycleanalysisdigitalsignalkernelkernelestimationlazybearmultitimeframeregressionsWave Analysiswavetrendwavetrendoscillator

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Хотите использовать этот скрипт на графике?


❤️ Patreon w/ Lorentzian 2.0: patreon.com/jdehorty

🎥 Lorentzian Classification Tutorial: youtu.be/AdINVvnJfX4

🤖 Discord: discord.com/invite/djXT5sAPfQ

⏩ LinkedIn: linkedin.com/in/justin-dehorty
Мои профили:

Отказ от ответственности