Onset Trend Detector Indicator for ThinkorSwim


Staff member
Onset Trend Detector is an indicator for ThinkorSwim that will give buy and sell signals. This script was developed by John F. Ehlers.


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


Shareable Link

Last edited:


Staff member
@zwarriortrader What do you mean by bundle?

Last edited:


Staff member
@zwarriortrader That's the Supertrend indicator. You can get it here.

Last edited:

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.