+ WaveTrend Oscillator

ClassicScott Updated   
I'm guessing most of you are familir with LazyBear's adaptation of the Wavetrend Oscillator; it's one of the most popular indicators on TradingView. I know others have done adaptations of it, but I thought I might as well, because that's kind of a thing I like doing.

In this version I've added a second Wavetrend plot. This is a thing I like to do. The longer plot gives you a longer timeframe momentum bias, and the shorter plot gives you entries and/or exits. Here we have one plot with a lookback period of 55, and another with the default set to 6 (change this to 14 if you think you might prefer something slower and that will plot similarly to the default RSI settings). With the traditional Wavetrend Oscillator there is a simple moving average on the WTO that is to help provide entries and exits. I've done away with this as there are already two plots, and I felt more would just clutter the indicator. Instead of plotting the SMA I've plotted the crosses along the bottom and top of the indicator. Also, as is not the case in LazyBear's version, this SMA length is adjustable. By default it is set to 3, which is the default setting on the original indicator.

I've also plotted background colors for when there is what I call a momentum shift. If one or the other oscillators crosses the centerline a colored bar is plotted. By default it is turned on for both WTOs, though in practice you might only want it on for the longer one.

I would say use of the indicator is similar to the original WTO or many other oscillators. Buying oversold and selling overbought, but being mindful of the momentum of the market. If the longer WTO is above the centerline it's best to be looking for dips to the centerline, or for an overbought signal by the faster WTO, and vice versa if the longer WTO is below the centerline. That said, you can also adjust the length of the SMA on the faster WTO to fine tune entries or exits, which is kind of how you would trade LazyBear's version. In this case you have that additional confirmation of market momentum.

You can set colored candles to either of the WTO plots via a dropdown menu.

There are alerts for overbought and oversold situations, centerline crosses, and Wavetrend crosses.

That's about it. Hope you enjoy this particular implementation of LazyBear's well known indicator.

Ah yes, last thing: Original version the source is set to hlc3. I've given you the opportunity to change that, so if you prefer using close you can, or whatever you want.
Release Notes:
I've been adding auto-plotting divergences to my oscillator indicators over the past several days. In this edition I've made it optional to select whether they are drawn from the primary wavetrend or the secondary wavetrend.

I also added an additional candle coloring element for those who are very particular about candle colors. I've added an option that does not color in a gradient, but colors based on if the oscillator is in overbought or oversold zones, or somewhere in between. Additionally I've made it so that these zones are adjustable. There is information in the tooltip that I added, but essentially the thought is that you very rarely, in trending environments, see oscillators reverse all the way back to what might be considered oversold or overbought, but instead pullback anywhere from the center of the oscillator to maybe the mid section of the upper or lower half (if even that). Here you can adjust the level to where you might expect that pullback to come, so that, perhaps if you're not in a trade, you might receive some visual indication that here is a spot you might want to enter.
I likely went entirely overboard with this addition, but mostly it was just a port from something similar in my overlay version of the indicator that plots shapes at the top or bottom of the chart instead of coloring the candles. It's also probably only pertinent to people who use color to highlight things in specific ways, but, eh, like most of this stuff, you don't have to use it if you don't want to.

Below we see a chart with colors set to default settings. No color indications for spotting possible pullbacks, and a good amount of blue, illustrating a strong downtrend.

Here, I have the inputs adjusted so that '40' is set as "overbought", and now we see visual cues in the candles where we might want to place a short (or get out of an underwater long). Furthermore, I set the as "oversold" -80. That probably doesn't matter so much, and it might actually be more useful to set it to a less negative number, and use the plotted bull divs to get into some risky fade longs, if you like higher risk setups such as that.
Release Notes:
fixed a display discrepancy in the style tab. carry on, nothing has changed. :)
Release Notes:
added alerts for divergences
Release Notes:
- updated to pinescript v5
- in the second wavetrend plot fixed what was supposed to be an SMA, but for some reason was an EMA, back to an SMA
Release Notes:
- fixed an issue with changing the opacity of indicator plots--it actually works now
- added a couple of new candle color options, same as the overlay version
Release Notes:
- just added an alert for the wavetrend crossing its moving average (the little blue and red dots above and below the oscillator)
Release Notes:
- fixed a mistake in the calculation for second Wavetrend
- changed default values to calculations I prefer to use

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?