Let’s take a look at WaveTrend with Crosses [LazyBear’s Indicator]

Samuel McCulloch
4 min readFeb 12, 2019

--

One of the things which you’re told as a trader from Day 1 is not to try and call tops and bottoms. It’s impossible really to predict when selling and buying pressure are fading. However, some clever use of indicators, we can get pretty damn close.

This is why I love using Lazybear’s Wave Trend with Crosses. The indicator raises my probabilities of catching the top. I primarily use for entry, waiting for extreme numbers and then placing a few small trades to try and catch a reversal.

WTwC is a bit like RSI, but it’s slower and provides good results on the 12h and daily. It is prone to more noise at lower time frames.

In this post I want to go through the code and dive into what makes this indicator work. Hopefully by the end you will know what you can do to adjust WTwC and use it for your own personal benefit. I’ve included the code in its entirety.

Let’s begin.

study(title=”WaveTrend with Crosses [LazyBear]”, shorttitle=”WT_CROSS_LB”)

Study name and title, also shout out to Lazybear for his great work.

n1 = input(10, “Channel Length”)
n2 = input(21, “Average Length”)

The first set of objects covers two inputs, 10 and 21, which are used later as the input lengths for EMAs. Making the numbers lower results in more signals, increasing them provides less signals.

obLevel1 = input(60, “Over Bought Level 1”)
obLevel2 = input(53, “Over Bought Level 2”)
osLevel1 = input(-60, “Over Sold Level 1”)
osLevel2 = input(-53, “Over Sold Level 2”)

These are the levels which will define the extremes of the indicator. It works similar to RSI, where a level above 60 is considered overbought and a level below -60 is oversold. Unlike RSI, at least on the daily or 12, its rare that the readings would stay above or below these extremes for any extended period of time. We will discuss why later.

ap = hlc3

Sets ap equal to average of the high low and close. Open is not included in this as its extraneous. It’s contained in the close of the previous candle. In relation to price ap will match closely.

esa = ema(ap, n1)

Sets esa as equal to the exponential moving average of the average taken above of prices. In this case the EMA is based on the previous ten candles. Will also trend closely to price.

d = ema(abs(ap — esa), n1)

Sets d as equal to the EMA of the absolute value of the average minus the EMA of the average, with a length of the past 21 candles. This number is always going to be positive and will serve its purpose in the next part. It will be a fraction of the price.

ci = (ap — esa) / (0.015 * d)

This is the equation that sets up the rest of the indicator. It takes the average of HLC and subtracts the EMA of the past 10 (n1) bars. The result is divded by 1.5% of d. The top number can either be positive or negative, however d will always be positive, which allows the indicator to trend back and forth between the two overbought/sold levels. This number also limits how far tci, listed below, can range within the levels. Of the top of my head, the max which it can range should be around 90.

tci = ema(ci, n2)

A 21 period EMA of the previous formula. It’s a smoothing function.

wt1 = tci
wt2 = sma(wt1,4)

Sets wt1 as equal to tci and wt2 as equal to the 4 period SMA of wt2. These two objects will be used to plot the indicator on the previously introduced Overbought and Oversold levels. I was wondering why he didn’t just use tci from above, but I think he wanted ease of coding when he was writing the plot functions.

plot(0, color=gray)
plot(obLevel1, color=red)
plot(osLevel1, color=green)
plot(obLevel2, color=red)
plot(osLevel2, color=green)

plot(wt1, color=green)
plot(wt2, color=red)
plot(wt1-wt2, color=blue, style=area, transp=80)
plot(cross(wt1, wt2) ? wt2 : na, color = black , style = circles, linewidth = 3)
plot(cross(wt1, wt2) ? wt2 : na, color = (wt2 — wt1 > 0 ? red : lime) , style = circles, linewidth = 2)
barcolor(cross(wt1, wt2) ? (wt2 — wt1 > 0 ? aqua : yellow) : na)

Most of the above are plot() functions to define the objects which need to be drawn. The main function here is the plot(cross()) which highlights when when wt1 crosses wt2.

In effect WTwC takes the difference between the EMAs, divided its by its absolute value and then plots it.

The questions I would have for lazybear would be the following:

  1. Why did you choose 1.5%? What’s the reasoning behind that.
  2. Why are the inputs defaulted at 10 and 21. For stocks its great. For Crypto, which runs 24/7, it still provides good results, but it may be better to slow it down.
  3. What are the changes to make for certain time frames?

In another post I’m going to cover how I use WTwCross and go over how it can be impelented with other indicators.

--

--