Trend Building & Exhausting for ThinkorSwim


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

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.


thinkScript Code

# Trend Building & Exhausting
# Assembled by BenTen at
# Converted by

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;


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

Similar threads