Onset Trend Detector Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
This is the Onset Trend Detector study, a NO-LAG oscillator that assesses trends by John F. Ehlers.

This oscillator combines two filters, the Super Smoother Filter and the Roofing Filter, also, designed by Ehlers.

The information from these filters goes through an automatic gain control algorithm and then undergoes a process called the quotient transform. This transform, regulated by the K coefficient, minimizes small oscillator values while maintaining higher values.

The upper study buy and sell signals are from:
https://usethinkscript.com/threads/supertrend-indicator-by-mobius-for-thinkorswim.7/ for confirmation

GhrCtyS.png


> Configure two lower studies

> [1] cutoffLength = 20 / k = 0.8

> [2] cutoffLength = 20 / k = 0.4

> Rules:

> [1] Buy when the first 30-period QT with K = 0.8 crosses 0 from below

> [2] Sell the position when the second 30-period QT with K = 0.4 crosses 0 from above

thinkScript Code
Rich (BB code):
declare lower;

input price = close;
input cutoffLength = 10;
input k = .8;

def alpha1 = (Cos(Sqrt(2) * Double.Pi / 100) + Sin (Sqrt(2) * Double.Pi / 100) - 1) / Cos(Sqrt(2) * Double.Pi / 100);
def highpass = if IsNaN(price + price[1] + price[2]) then highpass[1] else Sqr(1 - alpha1 / 2) * (price - 2 * price[1] + price[2]) + 2 * (1 - alpha1) * highpass[1] - Sqr(1 - alpha1) * highpass[2];
def filt = reference EhlersSuperSmootherFilter(highpass, cutoffLength);
def peak = if AbsValue(filt) > peak[1] * .991 then AbsValue(filt) else peak[1] * .991;
plot NormRoofingFilter = filt / peak;
plot Quotient = (NormRoofingFilter + k) / (k * NormRoofingFilter + 1);
plot ZeroLine = 0;

NormRoofingFilter.SetDefaultColor(GetColor(1));
Quotient.SetDefaultColor(GetColor(2));
ZeroLine.SetDefaultColor(GetColor(7));

Shareable Link
https://tos.mx/aQbyVg
 
Last edited by a moderator:
@zwarriortrader That's the Supertrend indicator. You can get it here.

 
Last edited:

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
293 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