Trend Exhaustion Indicator for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
This indicator uses pure price action and volume to identify when a trend is near exhaustion. It can be used as a warning sign for a potential reversal.
  • When Bulls are Exhausted: Volume is decreasing while the price continues to increase. We suspect that the move up is being driven by retail traders.
  • When Bears are Exhausted: Price is going down while volume is also decreasing. Could be a sign of trend exhaustion.
You can use this for intraday trading or on the higher timeframe to spot an exhausted trading trend. You can also use the ThinkorSwim's StockHacker to scan for bearish and bullish signals.





thinkScript Code

Code:
# Trend Exhaustion Indicator for ThinkorSwim
# Assembled by BenTen at useThinkScript.com

# Bearish
def bearish = (CLOSE > CLOSE[1] AND CLOSE [1] > CLOSE [2] AND CLOSE [2] > CLOSE [3] AND CLOSE [3] > CLOSE [4] AND VOLUMEAVG(LENGTH = 20) < VOLUMEAVG(LENGTH = 20)[1] AND VOLUMEAVG(LENGTH = 20)[1] < VOLUMEAVG(LENGTH = 20)[2] AND VOLUMEAVG(LENGTH = 20)[2] < VOLUMEAVG(LENGTH = 20)[3] and VOLUMEAVG(LENGTH = 20)[3] < VOLUMEAVG(LENGTH = 20)[4]);
plot bear = bearish;
bear.AssignValueColor(Color.CYAN);
bear.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

# Bullish
def bullish = (CLOSE < CLOSE[1] AND CLOSE [1] < CLOSE [2] AND CLOSE [2] < CLOSE [3] AND CLOSE [3] < CLOSE [4] AND VOLUMEAVG(LENGTH = 20) < VOLUMEAVG(LENGTH = 20)[1] AND VOLUMEAVG(LENGTH = 20)[1] < VOLUMEAVG(LENGTH = 20)[2] AND VOLUMEAVG(LENGTH = 20)[2] < VOLUMEAVG(LENGTH = 20)[3] and VOLUMEAVG(LENGTH = 20)[3] < VOLUMEAVG(LENGTH = 20)[4]);
plot bull = bullish;
bull.AssignValueColor(Color.WHITE);
bull.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

AddLabel(yes,"Bears Are Exhausted",color.WHITE);
AddLabel(yes,"Bulls Are Exhausted",color.CYAN);

# Alerts
Alert(bullish, " ", Alert.Bar, Sound.Chimes);
Alert(bearish, " ", Alert.Bar, Sound.Bell);

Shareable Link

 
Last edited:
T

tenacity11

Member
VIP
@tenacity11 You are not supposed to paste the entire indicator into the scanner. Add a new Study filter > select the indicator’s name > choose which type of signal you’re looking to scan.
Thanks Ben
 
T

tenacity11

Member
VIP
Ben I just created the indicator but nothing shows up on the chart arrow wise, I also tried to create a scan but got an error message Add Label not allowed in this context. Thanks
 
BenTen

BenTen

Administrative
Staff
VIP
Ben I just created the indicator but nothing shows up on the chart arrow wise, I also tried to create a scan but got an error message Add Label not allowed in this context. Thanks
Were you able to see the labels on the chart? If so, then there is nothing wrong with the indicator. Try switching timeframes and checking multiple timeframes. You can remove the last 2 lines from the code and it should fix the scanner issue.
 
T

tenacity11

Member
VIP
Were you able to see the labels on the chart? If so, then there is nothing wrong with the indicator. Try switching timeframes and checking multiple timeframes. You can remove the last 2 lines from the code and it should fix the scanner issue.
The labels are on the chart and I did try different time frames. When I take out the add label I get exactly one plot expected
 
BenTen

BenTen

Administrative
Staff
VIP
@tenacity11 The scanner is working for me, even with the default code above. Please check again.


 
T

tenacity11

Member
VIP
@tenacity11 The scanner is working for me, even with the default code above. Please check again.


Well I'm not sure why but I deleted and started over and still the same problem.
 
H

horserider

New member
For the non VIP people here is a possible alternative. Make sure to set the time agg to your chart time.
http://tos.mx/mfbFUp

Cannot see the exhaustion code so no good idea how it compares.
 
BenTen

BenTen

Administrative
Staff
VIP
Can you show me a screenshot of your scanner screen? @tenacity11
 
BenTen

BenTen

Administrative
Staff
VIP
@tenacity11 You are not supposed to paste the entire indicator into the scanner. Add a new Study filter > select the indicator’s name > choose which type of signal you’re looking to scan.
 
T

thinky

Member
How do you interpret the colors on the labels (white, yellow, cyan) and the arrow?

 
BenTen

BenTen

Administrative
Staff
VIP
@thinky There is no yellow (it was in the first screenshot because I originally included yellow as the primary color instead of CYAN). Refer to the definitions in the original post above.
 
T

thinky

Member
Ok, if bearish the arrow is cyan (Bulls Are Exhausted label) and points down, when bullish it is white (Bears Are Exhausted) and points up. Or you can comment out the labels and look at the direction of the arrow.

# Bearish
bear.AssignValueColor(Color.CYAN);
bear.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

# Bullish
bull.AssignValueColor(Color.WHITE);
bull.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
 
BenTen

BenTen

Administrative
Staff
VIP
@thinky That's up to you. Added the labels for myself because I also have other indicators with arrows too (and I assume I'm not the only one). The labels help to identify which signals are which.
 
BenTen

BenTen

Administrative
Staff
VIP
Alerts has been added. Please update your indicator.
 
MBF

MBF

New member
VIP
@thinky There is no yellow (it was in the first screenshot because I originally included yellow as the primary color instead of CYAN). Refer to the definitions in the original post above.
This is a hilarious thread. Sorry new here and snooping around. lol! 🤣
 
markos

markos

Active member
VIP
@MBF Keep snooping, your time will come. :eek: Actually, no problem, we all need to keep a sense of humor.
 
MBF

MBF

New member
VIP
@MBF Keep snooping, your time will come. :eek: Actually, no problem, we all need to keep a sense of humor.
No doubt, at least seven times a day. I chuckle because I am like this at times and it was funny to see I'm not the only one. Especially at the beginning. Yes I do have quite a sense of humor. Learning TOS is a feat in itself. cheers.:)🧠⚡My brain is fried! What a room this is!
 

Top