Onset Trend Detector Indicator for ThinkorSwim

BenTen

Staff member
Staff
VIP
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:

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

https://tos.mx/aQbyVg

Last edited by a moderator:
How do I get the bubbles on my chart?

Last edited by a moderator:
@zwarriortrader That's the Supertrend indicator. You can get it here.

Last edited:

Not the exact question you're looking for?

87k+ Posts
360 Online

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?