Trend Building & Exhausting for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
A remarkably simple but very useful indicator. Earlier and clearer signals than ADX or VHF. More positive ranging signal than any other indicators.
  • Aqua = ATR
  • Orange = StdDev
  • Red = Smoothed Moving Average of the StdDev
Usage:

Any pair, any time frame. Best used on majors and M15 period or higher
  • Orange breaks above Red when below Aqua = Trend building
  • Orange breaks below Red when above Aqua = Trend exhausting
  • Orange below Red when below Aqua = Ranging/Sideways market

I personally use this to identify when the current trend may be exhausting. That's why, by default, it will highlight only potential exhaustion bars on your chart (in white). If you prefer both, then remove the "#" from the second AssignPriceColor value.

cJXM1uJ.png


thinkScript Code

Code:
# Trend Building & Exhausting
# Assembled by BenTen at useThinkScript.com
# Converted by https://www.tradingview.com/script/xmfFlGrV-SFX-Trend-or-Range/

declare lower;

input ATR_len = 12;
input StdDev_len = 12;
input SMA_len = 3;

def ATR = atr(ATR_len);
def StdDev = stdev(close, StdDev_len);
def SMA = simpleMovingAvg(StdDev, SMA_len);

plot aqua = ATR;
plot orange = StdDev;
plot red = SMA;

aqua.SetDefaultColor(GetColor(1));
orange.SetDefaultColor(CreateColor(237,116,0));
red.SetDefaultColor(CreateColor(153,0,0));

# Extra: added color bars for exhaustion bars
def cond1 = orange crosses below red;
def cond2 = orange and red > aqua;
def cond3 = orange crosses above red;
def cond4 = orange and red < aqua;
def exhaustion = cond1 and cond2;
def trend_building = cond3 and cond4;

# The following will ONLY highlight potential trend exhaustion bar. This is active by default.
assignPriceColor(if exhaustion then color.WHITE else color.current);

# The following will highlight both trend exhaustion and trend building. Remove "#" to activate.

#assignPriceColor(if exhaustion then color.WHITE else if trend_building then color.MAGENTA else color.current);
 

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