WaveTrend Oscillator for ThinkorSwim [LazyBear]

@dolomick

Code:
#WT_LB Short Name TV

input Channel_Length = 10; #10
input Average_Length = 21; #10
input over_bought_1 = 60;
input over_bought_2 = 53;
input over_sold_1 = -60;
input over_sold_2 = -53;
input show_bubbles = yes;
input show_sec_bbls = no;
input show_alerts = yes;
def ap = hlc3;
def esa = ExpAverage(ap, Channel_Length);
def d = ExpAverage(AbsValue(ap - esa), Channel_Length);
def ci = (ap - esa) / (0.015 * d);
def tci = ExpAverage(ci, Average_Length);
def wt1 = tci;
def wt2 = SimpleMovingAvg(wt1, 4);
#def zero = 0;
plot zero = 0;
zero.SetDefaultColor( Color.GRAY );
zero.Hide();
plot obLevel1 = over_bought_1;
obLevel1.SetDefaultColor(Color.RED);
obLevel1.Hide();
plot osLevel1 = over_sold_1;
osLevel1.SetDefaultColor(Color.GREEN);
osLevel1.Hide();
plot obLevel2 = over_bought_2;
obLevel2.SetDefaultColor(Color.RED);
obLevel2.SetStyle(Curve.SHORT_DASH);
obLevel2.Hide();
plot osLevel2 = over_sold_2;
osLevel2.SetDefaultColor(Color.GREEN);
osLevel2.SetStyle(Curve.SHORT_DASH);
osLevel2.Hide();

plot wt1_1 = wt1;
wt1_1.SetDefaultColor(Color.GREEN);
 wt1_1.Hide();
plot wt2_1 = wt2;
wt2_1.SetDefaultColor(Color.RED);
wt2_1.SetStyle(Curve.POINTS);
 wt2_1.Hide();
plot wt3 = (wt1 - wt2);
wt3.SetDefaultColor(Color.BLUE);
wt3.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
 wt3.Hide();
def signal1 = wt1 crosses above wt2 and wt1 < over_sold_2;
plot Signal = if signal1 then (signal1 * over_sold_2) else Double.NaN;
Signal.SetDefaultColor(Color.GREEN);
Signal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Signal.SetLineWeight(3);
Signal.HideTitle();
def signal2 = wt1 crosses below wt2 and wt1 > over_bought_2;
plot Signal2_ = if signal2 then (signal2 * over_bought_2) else Double.NaN;
Signal2_.SetDefaultColor(Color.RED);
Signal2_.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
Signal2_.SetLineWeight(3);
Signal2_.HideTitle();
 
Did I just need to remove the lower study declaration? I tried declaring it an upper study but that didn't work? Thanks so much!!!
 
Yes remove " declare lower" and it should default to an upper study. "declare upper" should work. I hide all the plots so none show up on the upper study. Somtimes they will give you vertical lines. Also changed the "arrow up/down" to " boolean arrow up/down".
 
It's still early days, but this has been really cool to play with—thanks for sharing @BenTen. My first impression was that this felt similar to the MACD, but without the lag which is awesome. It's noticeably quicker and more responsive which has been great for intraday trading.

I decided to make a few modifications the original script to help reduce some of the cognitive load. I felt as if the colors and setup were a little noisy and hard to read while trading.

For those interested, I've attached an updated version that contains simplified line colors/styles, and also includes a histogram color sequence similar to the MACD—all of which should help to give the relevant information without having to stop and think.

https://tos.mx/2Q2yLvQ

sqbR0r9.png
 
Not directed at anyone. Just a statement of data can be manipulated different ways but it is still the same data and most likely will end up giving the same or very similar result. An understanding of the working of indicators can help in choosing which might be good to use. You may not wish to use more than one of the indicators of this same type as those would be giving you the same information.
 
@horserider that's predominantly my point. When it comes to the number of instruments used to provide signals, less is more. Give me a naked chart, a MACD, and a simple MA, and I'd be just as effective.

Without breaking off on too much of a tangent, and to give some context for those that may be lurking, I was drawn to this indicator because of the similarities it seems to have with other more common/traditional indicators out there. People give it stick, but I'm actually a huge fan of the MACD; the WTO almost feels like a slight upgrade.

When it comes to the latest and greatest, I generally like to stay in my lane, while steering clear of the the hype trains. That said, for some, this is all part of the fun. In short, you, do you.
 
so far not showing well on my CL 5 min chart today.
I think that has to do with the parameter of the indicator...try optimise it and you should see it fits quite well. Try 89 as the average length and you should see the result.
 
Can anyone turn this onto a TOS script....

Code:
//
// If you use this code in its original/modified form, do drop me a note.
//
study(title="WaveTrend [LazyBear]", shorttitle="WT_LB")
n1 = input(10, "Channel Length")
n2 = input(21, "Average Length")
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")

ap = hlc3
esa = ema(ap, n1)
d = ema(abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ema(ci, n2)

wt1 = tci
wt2 = sma(wt1,4)

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

plot(wt1, color=green)
plot(wt2, color=red, style=3)
plot(wt1-wt2, color=blue, style=area, transp=80)
 
@Topas Sorry I just threw that chart together as a demo to show the similarity of indicators so that chart has been erased long ago. Thus I am unable to share it. If you have questions about anything particular I will see if I can answer those.
 
@Topas Sorry I just threw that chart together as a demo to show the similarity of indicators so that chart has been erased long ago. Thus I am unable to share it. If you have questions about anything particular I will see if I can answer those.
Understood.... thanks for quick reply
 
@stocksniper Several studies were posted above, since you did not specify which one I assume you refer to the WaveTrend study that @BenTen posted in post #1 above. Just append the following two lines of code to the end of Ben's study and you'll have alerts on the arrows

Code:
Alert(signal, "WT Arrow UP", Alert.BAR, Sound.Ring);
Alert(signal2_, "WT Arrow DOWN", Alert.BAR, Sound.Ring);
 
@horserider Do you think this can work well with the Derivative RSI Oscillator? Can it completely replace MACD? I saw you one time tried to use the RSI Oscillator as a histogram and the Charting Wealth moving averages together but would WaveTrend Oscillator be a better choice?
 
@SparkyFlary No idea really as I never used Wave Trend. Guess I would lean toward time tested RSI or MACD style indicators. Wave trend does some type of massaging of exponential MAs and the difference so guess there is some similarity to the MACD. Best bet is put them all on your chart and see what works best for you.
 
I`ve been trying this study for the past week and i have to say that i like it! Mostly compared it with the TMO and from my testing using both studies on a 2min chart, the WTO is a bit slower with the signals compared with TMO but it gives less and more accurate signals which is important on a lower timeframe like the 2min.
So now, i use TMO only on 5min and WTO on 2min and they complete each other nicely.
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
360 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top