Triple Exhaustion Indicator For ThinkOrSwim

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
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
Good Morning, I just started playing with Sierra charts. It takes quite some time to learn the platform. Would you be able to share your workspace? Thanks
 

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

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
This is brilliant! I'll have to code up something similar (I assume you also want to keep that part proprietary) so that I can get 3 time frames at once in one chart. Also, a transition from colored candle to grey seems like a no brainer for selling credit spreads on the daily chart. Thanks for sharing this idea! Looks like it can be used lots of different ways
 
Here's what it looks like with a Heikin Ashi Indicator




Here's the code to get the plot: Chence27's Triple Exhaustion Indicator with My Heiki Ashi
added at the bottom. I have kept them separate so you can see.


*********************************************************
## 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/
## V 1.1 : @Chence27 - modifcations to better approximate original study
##
##
##

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.MAGENTA else if paintBars and sellerRegular then Color.GREEN else if buyerRegular and paintBars then Color.RED else if paintBars then Color.GRAY else Color.Current);

# --- Arrows/Triggers
plot RegularBuy = if sellerRegular[1] and !sellerRegular then low else Double.NaN;

RegularBuy.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);

RegularBuy.SetDefaultColor(Color.GREEN);


plot RegularSell = if buyerRegular[1] and !buyerRegular then high else Double.NaN;

RegularSell.SetPaintingStrategy(PaintingSTrategy.ARROW_Down);

RegularSell.SetDefaultColor(Color.RED);
RegularSell.SetLineWeight(3);
RegularBuy.SetLineWeight(3);
# --- Labels
AddLabel(showLabels,"SellerRegular",Color.RED);
AddLabel(showLabels,"SellerExtreme",Color.MAGENTA);
AddLabel(showLabels,"BuyerRegular",Color.GREEN);
AddLabel(showLabels,"BuyerExtreme",Color.CYAN);


#-----------------------------------------------------------------------------------------#
#-----------------------------------------------------------------------------------------#
# My Smoothed Heikin_Ashi_Moving_Average_S2
# skaboy 2010-2021
#########declare upper;
input s33_Period = 3;
input s33_Smooth = 3;
def s33_open = ExpAverage(open, s33_Period);
def s33_close = ExpAverage(close, s33_Period);
def s33_high = ExpAverage(high, s33_Period);
def s33_low = ExpAverage(low, s33_Period);

def s33_aclose = (s33_open + s33_high + s33_low + s33_close) * 0.25;
rec s33_aopen = CompoundValue(1, (s33_aopen[1] + s33_aclose[1]) * 0.5, (s33_open[1] + s33_close[1]) * 0.5);
def s33_ahigh = Max(s33_high, Max(s33_aclose, s33_aopen));
def s33_alow = Min(s33_low, Min(s33_aclose, s33_aopen));

def Avg_s33_aopen = Average(s33_aopen, s33_Period);
def Avg_s33_aclose = Average(s33_aclose, s33_Period);
def Avg_s33_ahigh = Average(s33_ahigh, s33_Smooth);
def Avg_s33_alow = Average(s33_alow, s33_Smooth);

def s33_Color = Avg_s33_aclose >= Avg_s33_aopen;
def s33_Sell = s33_Color[1] > s33_Color[0];
def s33_Buy = s33_Color[1] < s33_Color[0];

#-------------------display enhancement--------------------#
AddCloud(Avg_s33_aopen, Avg_s33_aclose, CreateColor(255, 0, 0), CreateColor(255, 255, 0));
AddCloud(Avg_s33_aopen, Avg_s33_aclose, CreateColor(255, 0, 0), CreateColor(255, 255, 0));
AddCloud(Avg_s33_aopen, Avg_s33_aclose, CreateColor(255, 0, 0), CreateColor(255, 255, 0));
#-----------------------------------------------------------------------------------------#
plot top_Signal = s33_Sell;
top_Signal.SetDefaultColor(CreateColor(255, 178, 0));
top_Signal.SetLineWeight(2);
top_Signal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

plot bot_Signal = s33_Buy;
bot_Signal.SetDefaultColor(CreateColor(255, 255, 0));
bot_Signal.SetLineWeight(2);
bot_Signal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
#-------------------end display enhancement ----------------------------#
 
Last edited:
I have updated my post above. It has what you are looking for. Hope it helps.
Bro your Heiken moving is fire!! Just don't know what setting I need to change to act like 9/20 ema ? I change the setting to 5 and seems to work ok, any info is appreciated.
 
Here's what it looks like with a Heikin Ashi Indicator




Here's the code to get the plot: Chence27's Triple Exhaustion Indicator with My Heiki Ashi
added at the bottom. I have kept them separate so you can see.


*********************************************************
## 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/
## V 1.1 : @Chence27 - modifcations to better approximate original study
##
##
##

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.MAGENTA else if paintBars and sellerRegular then Color.GREEN else if buyerRegular and paintBars then Color.RED else if paintBars then Color.GRAY else Color.Current);

# --- Arrows/Triggers
plot RegularBuy = if sellerRegular[1] and !sellerRegular then low else Double.NaN;

RegularBuy.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);

RegularBuy.SetDefaultColor(Color.GREEN);


plot RegularSell = if buyerRegular[1] and !buyerRegular then high else Double.NaN;

RegularSell.SetPaintingStrategy(PaintingSTrategy.ARROW_Down);

RegularSell.SetDefaultColor(Color.RED);
RegularSell.SetLineWeight(3);
RegularBuy.SetLineWeight(3);
# --- Labels
AddLabel(showLabels,"SellerRegular",Color.RED);
AddLabel(showLabels,"SellerExtreme",Color.MAGENTA);
AddLabel(showLabels,"BuyerRegular",Color.GREEN);
AddLabel(showLabels,"BuyerExtreme",Color.CYAN);


#-----------------------------------------------------------------------------------------#
#-----------------------------------------------------------------------------------------#
# My Smoothed Heikin_Ashi_Moving_Average_S2
# skaboy 2010-2021
#########declare upper;
input s33_Period = 3;
input s33_Smooth = 3;
def s33_open = ExpAverage(open, s33_Period);
def s33_close = ExpAverage(close, s33_Period);
def s33_high = ExpAverage(high, s33_Period);
def s33_low = ExpAverage(low, s33_Period);

def s33_aclose = (s33_open + s33_high + s33_low + s33_close) * 0.25;
rec s33_aopen = CompoundValue(1, (s33_aopen[1] + s33_aclose[1]) * 0.5, (s33_open[1] + s33_close[1]) * 0.5);
def s33_ahigh = Max(s33_high, Max(s33_aclose, s33_aopen));
def s33_alow = Min(s33_low, Min(s33_aclose, s33_aopen));

def Avg_s33_aopen = Average(s33_aopen, s33_Period);
def Avg_s33_aclose = Average(s33_aclose, s33_Period);
def Avg_s33_ahigh = Average(s33_ahigh, s33_Smooth);
def Avg_s33_alow = Average(s33_alow, s33_Smooth);

def s33_Color = Avg_s33_aclose >= Avg_s33_aopen;
def s33_Sell = s33_Color[1] > s33_Color[0];
def s33_Buy = s33_Color[1] < s33_Color[0];

#-------------------display enhancement--------------------#
AddCloud(Avg_s33_aopen, Avg_s33_aclose, CreateColor(255, 0, 0), CreateColor(255, 255, 0));
AddCloud(Avg_s33_aopen, Avg_s33_aclose, CreateColor(255, 0, 0), CreateColor(255, 255, 0));
AddCloud(Avg_s33_aopen, Avg_s33_aclose, CreateColor(255, 0, 0), CreateColor(255, 255, 0));
#-----------------------------------------------------------------------------------------#
plot top_Signal = s33_Sell;
top_Signal.SetDefaultColor(CreateColor(255, 178, 0));
top_Signal.SetLineWeight(2);
top_Signal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

plot bot_Signal = s33_Buy;
bot_Signal.SetDefaultColor(CreateColor(255, 255, 0));
bot_Signal.SetLineWeight(2);
bot_Signal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
#-------------------end display enhancement ----------------------------#
sellerRegular then Color.GREEN else if buyerRegular and paintBars then Color.RED else if paintBars then Color.GRAY else Color.Current);


can you explain what is the reason for green color when seller regular instead of red color
 
Using the True Momentum Oscillator can be very helpful
I agree. I have looked back on the SPY chart (the only thing I trade) and you can see the situations you mention. I am not criticizing this indicator...it does have some real possibilities. But I have found these problems with other indicators. It seems to be a bit better picking tops and bottoms when the markets are more choppy and there are no strong trends interday. Thanks to the creators who take the time and effort to construct these things.
 
I tried using your code for the scanner but after I paste it in, the OK button is grayed out and i cannot hit ok. Any ideas?
Definitely. Try saving the indicator as a STUDY then use it in the Stock Scanner. When selecting a condition (one of the 4 options) select "Is True". Let me know if that works.
 
@cos251 are you on discord? If so let's link up, send me a friend request, my handle is vincefield#3962. Anyone else who wants to talk trading, studies, etc. also feel free to add me there.
Chence - sent you a request on Discord. Have a small group of us who trade all day and tinker with thinkscript and pinescript - always looking to talk shop or hand and trade all day.
 
on my end, I try the scanner with condition "equal to 1" or "is true"...and run through all stocks in SP500 on 5 min, 15min, 1h, 4h...still do not return any result. But no error message neither. strange.
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.
 
Very interesting and appears to work quite well, however once the underlying instrument goes into super trend (up or down) then this indicator gives signal (sell or buy) [which is correct as per underlying indicators] and will exit way too early leaving potential gains or enter way to early inuring further loss.

Need to add some guard rails to avoid getting out too early in super up trend and avoid getting in too early in super down trend.

Thanks for sharing the study, appreciate it. :)
There is no exit signal lol what are you referring to?
 
Love this indicator but can't for the life of me get a scan to work.
Try this guys.
I've been scanning on the 1m, 2m and 5m with this this morning. I get results and underlying is in trend when the scanner says it is.

https://tos.mx/Kv9D7b2

edited by mod:
  1. Copy&Paste scanner code into study tab: https://usethinkscript.com/threads/triple-exhaustion-indicator-for-thinkorswim.9001/#post-82648
  2. Name the study: FVO_Triple_Exhaustion_Indicator_SCAN
  3. Import Scanner Link: https://tos.mx/Kv9D7b2 Click here for --> Easiest way to load shared links

FWn8lPB.png

@bmann777 @fingerlakes
 
Last edited by a moderator:
Try this guys.
I've been scanning on the 1m, 2m and 5m with this this morning. I get results and underlying is in trend when the scanner says it is.

https://tos.mx/Kv9D7b2

edited by mod:
  1. Copy&Paste scanner code into study tab: https://usethinkscript.com/threads/triple-exhaustion-indicator-for-thinkorswim.9001/#post-82648
  2. Name the study: FVO_Triple_Exhaustion_Indicator_SCAN
  3. Import Scanner Link: https://tos.mx/Kv9D7b2 Click here for --> Easiest way to load shared links
@bmann777 @fingerlakes
I still get nothing. I'll keep toying with it. I have to say this indicator seems to work really well with the Standard Deviation Channels.
 
# My Smoothed Heikin_Ashi_Moving_Average_S2
# skaboy 2010-2021
#########declare upper;
input s33_Period = 3;
input s33_Smooth = 3;
def s33_open = ExpAverage(open, s33_Period);
def s33_close = ExpAverage(close, s33_Period);
def s33_high = ExpAverage(high, s33_Period);
def s33_low = ExpAverage(low, s33_Period);

def s33_aclose = (s33_open + s33_high + s33_low + s33_close) * 0.25;
rec s33_aopen = CompoundValue(1, (s33_aopen[1] + s33_aclose[1]) * 0.5, (s33_open[1] + s33_close[1]) * 0.5);
def s33_ahigh = Max(s33_high, Max(s33_aclose, s33_aopen));
def s33_alow = Min(s33_low, Min(s33_aclose, s33_aopen));

def Avg_s33_aopen = Average(s33_aopen, s33_Period);
def Avg_s33_aclose = Average(s33_aclose, s33_Period);
def Avg_s33_ahigh = Average(s33_ahigh, s33_Smooth);
def Avg_s33_alow = Average(s33_alow, s33_Smooth);

def s33_Color = Avg_s33_aclose >= Avg_s33_aopen;
def s33_Sell = s33_Color[1] > s33_Color[0];
def s33_Buy = s33_Color[1] < s33_Color[0];

#-------------------display enhancement--------------------#
AddCloud(Avg_s33_aopen, Avg_s33_aclose, CreateColor(255, 0, 0), CreateColor(255, 255, 0));
AddCloud(Avg_s33_aopen, Avg_s33_aclose, CreateColor(255, 0, 0), CreateColor(255, 255, 0));
AddCloud(Avg_s33_aopen, Avg_s33_aclose, CreateColor(255, 0, 0), CreateColor(255, 255, 0));
#-----------------------------------------------------------------------------------------#
plot top_Signal = s33_Sell;
top_Signal.SetDefaultColor(CreateColor(255, 178, 0));
top_Signal.SetLineWeight(2);
top_Signal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

plot bot_Signal = s33_Buy;
bot_Signal.SetDefaultColor(CreateColor(255, 255, 0));
bot_Signal.SetLineWeight(2);
bot_Signal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
#-------------------end display enhancement ----------------------------#
Hello @skaboy et. al,

I am pretty new to this thinkscript thing and wondering if your Smoothed Heikin_Ashi_Moving_Average_S2 ThinkScript could be coded for conditional orders also? If so, please provide the code for using for Conditional Order, or provide suggestions on how it can be done? I like the entries and exits, and if used in conjunction with the SuperTrend Reversals and some other unique strategies here would be so very helpful. Most of these complex coding cannot be used for Conditional Orders, and wondering if your strategy is simple enough to be used for that purpose in addition to displaying on the charts. Thank you.

Boua.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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