Triple Exhaustion Indicator For ThinkOrSwim

Would you be willing to post it or post a link to this?
Sure, here´s the modified TMO code i use with AlertDisplace added if you only want the alert to trigger after candle has closed. Remember to
uncheck all the boxes in plot settings as well.

Code:
#True (M)omentum (O)scilator)
# Mobius
# V01.05.2018
# hint: TMO calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price.

#declare Lower;

input length = 14;
input calcLength = 5;
input smoothLength = 3;
input AlertDisplace = 0;

def o = open;
def c = close;
def data = fold i = 0 to length
           with s
           do s + (if c > getValue(o, i)
                   then 1
                   else if c < getValue(o, i)
                        then - 1
                        else 0);
def EMA5 = ExpAverage(data, calcLength);
plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
     Main.AssignValueColor(if Main > Signal
                           then color.green
                           else color.light_red);
     Signal.AssignValueColor(if Main > Signal
                             then color.green
                             else color.light_red);
     Signal.HideBubble();
     Signal.HideTitle();
#addCloud(Main, Signal, color.green, color.light_red);
plot zero = if isNaN(c) then double.nan else 0;
     zero.SetDefaultColor(Color.gray);
     zero.hideBubble();
     zero.hideTitle();
plot ob = if isNaN(c) then double.nan else round(length * .7);
     ob.SetDefaultColor(Color.gray);
     ob.HideBubble();
     ob.HideTitle();
plot os = if isNaN(c) then double.nan else -round(length * .7);
     os.SetDefaultColor(Color.gray);
     os.HideBubble();
     os.HideTitle();
#addCloud(ob, length, color.light_red, color.light_red, no);
#addCloud(-length, os, color.light_green, color.light_green);

def BUYsignal =Main < OS and Main crosses above Signal;
def SELLsignal = Main > OB and Main crosses below Signal;
addverticalline(BUYsignal,"Buy",color.green,curve.short_dash);
addverticalline(SELLsignal,"Sell",color.red,curve.short_dash);

# Alerts
Alert(BuySignal[AlertDisplace], " ", Alert.Bar, Sound.ding);
Alert(SellSignal[AlertDisplace], " ", Alert.Bar, Sound.chimes);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Sure, here´s the modified TMO code i use with AlertDisplace added if you only want the alert to trigger after candle has closed. Remember to
uncheck all the boxes in plot settings as well.

Code:
#True (M)omentum (O)scilator)
# Mobius
# V01.05.2018
# hint: TMO calculates momentum using the delta of price. Giving a much better picture of trend, tend reversals and divergence than momentum oscillators using price.

#declare Lower;

input length = 14;
input calcLength = 5;
input smoothLength = 3;
input AlertDisplace = 0;

def o = open;
def c = close;
def data = fold i = 0 to length
           with s
           do s + (if c > getValue(o, i)
                   then 1
                   else if c < getValue(o, i)
                        then - 1
                        else 0);
def EMA5 = ExpAverage(data, calcLength);
plot Main = ExpAverage(EMA5, smoothLength);
plot Signal = ExpAverage(Main, smoothLength);
     Main.AssignValueColor(if Main > Signal
                           then color.green
                           else color.light_red);
     Signal.AssignValueColor(if Main > Signal
                             then color.green
                             else color.light_red);
     Signal.HideBubble();
     Signal.HideTitle();
#addCloud(Main, Signal, color.green, color.light_red);
plot zero = if isNaN(c) then double.nan else 0;
     zero.SetDefaultColor(Color.gray);
     zero.hideBubble();
     zero.hideTitle();
plot ob = if isNaN(c) then double.nan else round(length * .7);
     ob.SetDefaultColor(Color.gray);
     ob.HideBubble();
     ob.HideTitle();
plot os = if isNaN(c) then double.nan else -round(length * .7);
     os.SetDefaultColor(Color.gray);
     os.HideBubble();
     os.HideTitle();
#addCloud(ob, length, color.light_red, color.light_red, no);
#addCloud(-length, os, color.light_green, color.light_green);

def BUYsignal =Main < OS and Main crosses above Signal;
def SELLsignal = Main > OB and Main crosses below Signal;
addverticalline(BUYsignal,"Buy",color.green,curve.short_dash);
addverticalline(SELLsignal,"Sell",color.red,curve.short_dash);

# Alerts
Alert(BuySignal[AlertDisplace], " ", Alert.Bar, Sound.ding);
Alert(SellSignal[AlertDisplace], " ", Alert.Bar, Sound.chimes);

Thank you very much for this; it looks great! I read through the past posts, but don't understand how I can create a Scan based on this idea. I got the grey "ok" button that someone mentioned before, and you told them only 1 item can be TRUE. I commented out 3 of the 4, but get no results when I run the Scan. I'm new to TOS scans and scripts, so any help is very appreciated!
 
Triple Exhaustion Indicator SCAN (Scanner)
Ruby:
## Triple Exhaustion Indicator SCAN
##
##
## CREDITS
## Requested by @Chence27 from criteria listed here https://usethinkscript.com/threads/triple-exhaustion-indicator.9001/
## SCAN requested by @Trader_Andrew
##
## Removing the header Credit credits and description is not permitted, any modification needs to be shared.
##
## V 1.0 :    @cos251 - Initial release per request from www.usethinkscript.com forum thread:
##       :    https://usethinkscript.com/threads/triple-exhaustion-indicator.9001/
##       :    SCAN version requested by @Trader_Andrew
##
##
##


# --- Inputs
input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input averageType = AverageType.SIMPLE;
input length = 1000;
input paintBars = yes;
input showLabels = yes;


# --- Indicators - StochasticSlow / MACD / MACD StDev / DMI+/-
def SlowK = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageType).FullK;
def MACD = reference MACD()."Value";
def priceMean = Average(MACD, length);
def MACD_stdev =  (MACD - priceMean) / StDev(MACD, length);
def dPlus = reference DMI()."DI+";
def dMinus = reference DMI()."DI-";
# --- End Indicators

# --- Conditions
def sellerRegular = SlowK < 20 and MACD_stdev < -1 and dPlus < 15;
def buyerRegular = SlowK > 80 and MACD_stdev > 1 and dMinus < 15;
# --- End Conditions

# --- Arrows/Triggers
plot RegularBuyArrow = if sellerRegular[1] and !sellerRegular then 1 else Double.NaN;
plot RegularSellArrow = if buyerRegular[1] and !buyerRegular then 1 else Double.NaN;
plot RegularBuyTrendExists = if sellerRegular then 1 else Double.NaN;
plot RegularSellTrendExists = if buyerRegular then 1 else Double.NaN;
I've been trying to get this SCAN to work on longer times frames for days now, I think I figured it out. In order for the SCAN to work on daily timeframes, I had to change the SCAN length to 100 to 400 .

On the actual Daily Chart of the Ticker, the study has 799 as the length but for the SCAN, it had to be 100 to 400 for me.
 
Last edited:
I copied the code and saved it as a new study. Then went to the scanner and used it. Seems to be working for me. I was scanning on 1m TF, higher TF's may be more difficult to catch.
Cos251, As usual, I'm late to the party, but I've been able to get the Triple Exhaustion indicator to work in my charts and love what I'm seeing But like you (initially anyway), I am unable to get it to work as a scan.
Can you go into a little more detail on how you made it work?
I copied the "script" into the "Thinkscript Editor" in the Scan tab, but the results I get don't show any candidates with the Buy arrow. I'm using a 1 year by the day chart, and the only other scan limiter is a stock price > $5.
 
Cos251, As usual, I'm late to the party, but I've been able to get the Triple Exhaustion indicator to work in my charts and love what I'm seeing But like you (initially anyway), I am unable to get it to work as a scan.
Can you go into a little more detail on how you made it work?
I copied the "script" into the "Thinkscript Editor" in the Scan tab, but the results I get don't show any candidates with the Buy arrow. I'm using a 1 year by the day chart, and the only other scan limiter is a stock price > $5.
Change the length to 400
 
Check to see if all criteria was coded as you indicated. Hopefully this is what you were looking for.

Triple Exhaustion Indicator

4TxCJVA.jpg


Ruby:
## Triple Exhaustion Indicator
##
##
## CREDITS
## Requested by @Chence27 from criteria listed here https://usethinkscript.com/threads/triple-exhaustion-indicator.9001/
##
##
## Removing the header Credit credits and description is not permitted, any modification needs to be shared.
##
## V 1.0 :    @cos251 - Initial release per request from www.usethinkscript.com forum thread:
##       :    https://usethinkscript.com/threads/triple-exhaustion-indicator.9001/
##
##
##

declare upper;

# --- Inputs
input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input averageType = AverageType.SIMPLE;
input length = 1000;
input paintBars = yes;
input showLabels = yes;


# --- Indicators - StochasticSlow / MACD / MACD StDev / DMI+/-
def SlowK = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageType).FullK;
def MACD = reference MACD()."Value";
def priceMean = Average(MACD, length);
def MACD_stdev =  (MACD - priceMean) / StDev(MACD, length);
def dPlus = reference DMI()."DI+";
def dMinus = reference DMI()."DI-";
# --- End Indicators

# --- Conditions
def sellerRegular = SlowK < 20 and MACD_stdev < -1 and dPlus < 15;
def sellerExtreme = SlowK < 20 and MACD_stdev < -2 and dPlus < 15;
def buyerRegular = SlowK > 80 and MACD_stdev > 1 and dMinus < 15;
def buyerExtreme = SlowK > 80 and MACD_stdev > 2 and dMinus < 15;
# --- End Conditions

# -- Price Color
AssignPriceColor( if paintBars and sellerExtreme then Color.CYAN else if buyerExtreme and paintBars then Color.GREEN else if paintBars and sellerRegular then Color.YELLOW else if buyerRegular and paintBars then Color.DARK_GREEN else if paintBars then Color.GRAY else Color.Current);

# --- Arrows/Triggers
plot RegularBuy = if sellerRegular[1] and !sellerRegular then low else Double.NaN;
plot ExtremeBuy = if sellerExtreme[1] and !sellerExtreme then low else Double.NaN;
RegularBuy.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
ExtremeBuy.SetPaintingSTrategy(paintingSTrategy.Arrow_UP);
RegularBuy.SetDefaultColor(Color.LIME);
ExtremeBuy.SetDefaultColor(Color.GREEN);

plot RegularSell = if buyerRegular[1] and !buyerRegular then high else Double.NaN;
plot ExtremeSell = if buyerExtreme[1] and !buyerExtreme then high else Double.NaN;
RegularSell.SetPaintingStrategy(PaintingSTrategy.ARROW_Down);
ExtremeSell.SetPaintingSTrategy(paintingSTrategy.Arrow_DOWN);
RegularSell.SetDefaultColor(Color.Light_RED);
ExtremeSell.SetDefaultColor(Color.RED);

# --- Labels
AddLabel(showLabels,"SellerRegular",Color.YELLOW);
AddLabel(showLabels,"SellerExtreme",Color.CYAN);
AddLabel(showLabels,"BuyerRegular",Color.DARK_GREEN);
AddLabel(showLabels,"BuyerExtreme",Color.GREEN);


Triple Exhaustion Indicator SCAN (Scanner)
Ruby:
## Triple Exhaustion Indicator SCAN
##
##
## CREDITS
## Requested by @Chence27 from criteria listed here https://usethinkscript.com/threads/triple-exhaustion-indicator.9001/
## SCAN requested by @Trader_Andrew
##
## Removing the header Credit credits and description is not permitted, any modification needs to be shared.
##
## V 1.0 :    @cos251 - Initial release per request from www.usethinkscript.com forum thread:
##       :    https://usethinkscript.com/threads/triple-exhaustion-indicator.9001/
##       :    SCAN version requested by @Trader_Andrew
##
##
##


# --- Inputs
input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 10;
input priceH = high;
input priceL = low;
input priceC = close;
input averageType = AverageType.SIMPLE;
input length = 1000;
input paintBars = yes;
input showLabels = yes;


# --- Indicators - StochasticSlow / MACD / MACD StDev / DMI+/-
def SlowK = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageType).FullK;
def MACD = reference MACD()."Value";
def priceMean = Average(MACD, length);
def MACD_stdev =  (MACD - priceMean) / StDev(MACD, length);
def dPlus = reference DMI()."DI+";
def dMinus = reference DMI()."DI-";
# --- End Indicators

# --- Conditions
def sellerRegular = SlowK < 20 and MACD_stdev < -1 and dPlus < 15;
def buyerRegular = SlowK > 80 and MACD_stdev > 1 and dMinus < 15;
# --- End Conditions

# --- Arrows/Triggers
plot RegularBuyArrow = if sellerRegular[1] and !sellerRegular then 1 else Double.NaN;
plot RegularSellArrow = if buyerRegular[1] and !buyerRegular then 1 else Double.NaN;
plot RegularBuyTrendExists = if sellerRegular then 1 else Double.NaN;
plot RegularSellTrendExists = if buyerRegular then 1 else Double.NaN;
@cos251 Thank you very much!!
 
Who's ready to step in and catch this falling QQQ knife? Daily buy signal with TMO confirming (y)
Stocks rallied hard into the close and finished at their highs on the day. Looks like a short term bottom. It seemed like more than end-of-week short covering in a bear phase. Apple certainly helped the psychology.
 
Stocks rallied hard into the close and finished at their highs on the day. Looks like a short term bottom. It seemed like more than end-of-week short covering in a bear phase. Apple certainly helped the psychology.
421 stocks were up > 4%..... and I filtered the scan.... I didn't want many choices only the strongest and some very nice patterns... TQQQ
kIRGIDK.png
 
Last edited by a moderator:
I use this study as a multi time frame system. For NQ I use 750, 2000 and 5000 volume charts (TOS doesn't have volume bars I don't believe so tick charts will be the closest you can get) and for ES I use 2000, 5000 and 10000 volume charts.

The highlighted vertical colored regions are the highest time frame, the colored bars are the middle time frame, and the dots are the lower time frame. The size and length of the triangles also correspond to the time frame.

xXJ3ehM.png

SESSPQN.png

Bbv0KZj.png
Can you share code to make these vertical clouds?
 
Can you share code to make these vertical clouds?
These vertical shaded regions are from the Sierra chart version of the study. They are simply the signal at a higher time. They are no different from the TOS version and can be changed to any signal that TOS is capable of displaying.
 
With the paint feature on I get grey candles for most of the time, but sometimes there's red & green candles. What's the sginiciance of those colored candles?
elmLiTS.png
 
With the paint feature on I get grey candles for most of the time, but sometimes there's red & green candles. What's the sginiciance of those colored candles?
elmLiTS.png
Colored candles mean the triple overbought/oversold condition is present. Arrows are when it releases.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
296 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