Triple Exhaustion Indicator For ThinkOrSwim

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 ----------------------------#
Would you be willing to share your Heiken Ashi Chart? Thank you,

Jeff
 
Check to see if all criteria was coded as you indicated. Hopefully this is what you were looking for.

Triple Exhaustion Indicator
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)
**UPDATE - added extreme buy and trend plots!

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.1 :    @cos251 - Added Extreme buy arrow and trend plots
##
## 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 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

# --- Arrows/Triggers
plot RegularBuyArrow = if sellerRegular[1] and !sellerRegular then 1 else Double.NaN;
plot ExtremeBuyArrow = if sellerExtreme[1] and !sellerExtreme then 1 else Double.NaN;
plot RegularSellArrow = if buyerRegular[1] and !buyerRegular then 1 else Double.NaN;
plot ExtremeSellArrow = if buyerExtreme[1] and !buyerExtreme then 1 else Double.NaN;
plot RegularBuyTrendExists = if sellerRegular then 1 else Double.NaN;
plot ExtremeBuyTrendExists = if sellerExtreme then 1 else Double.NaN;
plot RegularSellTrendExists = if buyerRegular then 1 else Double.NaN;
plot ExtremeSellTrendExists = if buyerExtreme then 1 else DOuble.NaN;
Thanks for the code, I am not able to get the scanner to work. can you provide details on using the scanner. thanks
I am not able to get scanner to work, can you provide details . thanks
 
Last edited:
Triple Exhaustion Indicator SCAN (Scanner)
**UPDATE - added extreme buy and trend plots!

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.1 :    @cos251 - Added Extreme buy arrow and trend plots
##
## 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 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

# --- Arrows/Triggers
plot RegularBuyArrow = if sellerRegular[1] and !sellerRegular then 1 else Double.NaN;
plot ExtremeBuyArrow = if sellerExtreme[1] and !sellerExtreme then 1 else Double.NaN;
plot RegularSellArrow = if buyerRegular[1] and !buyerRegular then 1 else Double.NaN;
plot ExtremeSellArrow = if buyerExtreme[1] and !buyerExtreme then 1 else Double.NaN;
plot RegularBuyTrendExists = if sellerRegular then 1 else Double.NaN;
plot ExtremeBuyTrendExists = if sellerExtreme then 1 else Double.NaN;
plot RegularSellTrendExists = if buyerRegular then 1 else Double.NaN;
plot ExtremeSellTrendExists = if buyerExtreme then 1 else DOuble.NaN;
I have copy the scanner code paste it to the scanner study. But I am getting Error. can you kindly help to get the scanner working .. thanks
 
Thank you @cos251. This is a great indicator. Can it be mobile friendly?
Yes it is mobile friendly... you will not see the colored candles only the arrows which indicates the end of exhaustion. I use it with my mobile setup.

Here is a screenshot of /ES 5min chart …

The red and green circles are Triple Exhastion… the circle that is dark inside is extreme exhaustion the circle with the lighter color inside is regular exhaustion

 
Triple Exhaustion MTF

  • As of now it shows verticle lines with a label to identify if it is Agg1 2 3 or 4
  • I generally add it on to a lower volume study or EMAD lower (from Confirmation Candles thread)
  • If I am on a 5min chart I use the triple exhaustion study (the original one) and change the arrows to dots then use the MTF in a lower study set to 10, 15, 30, 1hr
  • It will paint candles in the upper also if you so choose
  • The code for arrows is # out so if you want to change to arrows just remove the # (copy and paste code to CHAT GPT and tell it to remove the # from each plot… easy money)

Code:
# 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/
##
##
## adding MTF labels @irishgold 08/22/2022

declare upper;
input agperiod1 = { "1 min", default "2 min", "3 min", "5 min", "10 min", "15 min", "30 min", "1 hour", "2 hours", "4 hours", "Day", "Week", "Month"};
input agperiod2 = {"1 min", "2 min", "3 min", default "5 min", "10 min", "15 min", "30 min", "1 hour", "2 hours", "4 hours", "Day", "Week", "Month"};
input agperiod3 = {"1 min", "2 min", "3 min", "5 min", default "10 min", "15 min", "30 min", "1 hour", "2 hours", "4 hours", "Day", "Week", "Month"};
input agperiod4 = {"1 min", "2 min", "3 min", "5 min", "10 min",  default "15 min", "30 min", "1 hour", "2 hours", "4 hours", "Day", "Week", "Month"};
input DI_Length = 14;

# --- Inputs

input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 10;

# --- Def

def currentPeriod = GetAggregationPeriod();

def priceH1 = high(period = agperiod1);
def priceH2 = high(period = agperiod2);
def priceH3 = high(period = agperiod3);
def priceH4 = high(period = agperiod4);
def priceL1 = low(period = agperiod1);
def priceL2 = low(period = agperiod2);
def priceL3 = low(period = agperiod3);
def priceL4 = low(period = agperiod4);
def priceC1 = close(period = agperiod1);
def priceC2 = close(period = agperiod2);
def priceC3 = close(period = agperiod3);
def priceC4 = close(period = agperiod4);


input priceH = high;
input priceL = low;
input priceC = close;
input averageType = AverageType.SIMPLE;
input length = 500;
input paintBars = yes;
input showLabels = yes;
input percentGain = .005;

# --- Indicators - StochasticSlow / MACD / MACD StDev / DMI+/-
def SlowK = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageType).FullK;

def SlowK1 = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH1, priceL1, priceC1, 3, averageType).FullK;

def SlowK2 = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH2, priceL2, priceC2, 3, averageType).FullK;

def SlowK3 = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH3, priceL3, priceC3, 3, averageType).FullK;

def SlowK4 = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH4, priceL4, priceC4, 3, averageType).FullK;

def MACD = reference MACD()."Value";
# This section is for the aggregations term MACD

def MACD1 = (ExpAverage(priceC1[1], 12)) - (ExpAverage(priceC1[1], 26));

def MACD2 = (ExpAverage(priceC2[1], 12)) - (ExpAverage(priceC2[1], 26));

def MACD3 = (ExpAverage(priceC3[1], 12)) - (ExpAverage(priceC3[1], 26));

def MACD4 = (ExpAverage(priceC4[1], 12)) - (ExpAverage(priceC4[1], 26));

def priceMean1 = SimpleMovingAvg(MACD1, length);

def priceMean2 = SimpleMovingAvg(MACD2, length);

def priceMean3 = SimpleMovingAvg(MACD3, length);

def priceMean4 = SimpleMovingAvg(MACD4, length);


def MACD_stdev1 = (MACD1 - priceMean1) / StDev(MACD1, length);

def MACD_stdev2 = (MACD2 - priceMean2) / StDev(MACD2, length);

def MACD_stdev3 = (MACD3 - priceMean3) / StDev(MACD3, length);

def MACD_stdev4 = (MACD4 - priceMean4) / StDev(MACD4, length);



def priceMean = SimpleMovingAvg(MACD, length);

def MACD_stdev =  (MACD - priceMean) / StDev(MACD, length);

def dPlus = reference DMI()."DI+";

def dMinus = reference DMI()."DI-";

# DMI computations


def hiDiff1 = priceH1 - priceH1[1];

def loDiff1 = priceL1[1] - priceL1;

def plusDM1 = if hiDiff1 > loDiff1 and hiDiff1 > 0 then hiDiff1 else 0;

def minusDM1 =  if loDiff1 > hiDiff1 and loDiff1 > 0 then loDiff1 else 0;

def ATR1 = MovingAverage(averageType, TrueRange(priceH1, priceC1, priceL1), DI_Length);

def dPlus1 = 100 * MovingAverage(AverageType.WILDERS, plusDM1, DI_Length) / ATR1;

def dMinus1 = 100 * MovingAverage(AverageType.WILDERS, minusDM1, DI_Length) / ATR1;


def hiDiff2 = priceH2 - priceH2[1];

def loDiff2 = priceL2[1] - priceL2;

def plusDM2 = if hiDiff2 > loDiff2 and hiDiff2 > 0 then hiDiff2 else 0;

def minusDM2 =  if loDiff2 > hiDiff2 and loDiff2 > 0 then loDiff2 else 0;

def ATR2 = MovingAverage(averageType, TrueRange(priceH2, priceC2, priceL2),
DI_Length);

def dPlus2 = 100 * MovingAverage(AverageType.WILDERS, plusDM2, DI_Length) / ATR2;

def dMinus2 = 100 * MovingAverage(AverageType.WILDERS, minusDM2, DI_Length) / ATR2;

def hiDiff3 = priceH3 - priceH3[1];

def loDiff3 = priceL3[1] - priceL3;

def plusDM3 = if hiDiff3 > loDiff3 and hiDiff3 > 0 then hiDiff3 else 0;

def minusDM3 =  if loDiff3 > hiDiff3 and loDiff3 > 0 then loDiff3 else 0;

def ATR3 = MovingAverage(averageType, TrueRange(priceH3, priceC3, priceL3), DI_Length);

def dPlus3 = 100 * MovingAverage(AverageType.WILDERS, plusDM3, DI_Length) /
ATR3;

def dMinus3 = 100 * MovingAverage(AverageType.WILDERS, minusDM3, DI_Length) / ATR3;


def hiDiff4 = priceH4 - priceH4[1];

def loDiff4 = priceL4[1] - priceL4;

def plusDM4 = if hiDiff4 > loDiff4 and hiDiff4 > 0 then hiDiff4 else 0;

def minusDM4 =  if loDiff4 > hiDiff4 and loDiff4 > 0 then loDiff4 else 0;

def ATR4 = MovingAverage(averageType, TrueRange(priceH4, priceC4, priceL4), DI_Length);

def dPlus4 = 100 * MovingAverage(AverageType.WILDERS, plusDM4, DI_Length) / ATR4;

def dMinus4 = 100 * MovingAverage(AverageType.WILDERS, minusDM4, DI_Length) / ATR4;

# --- End Indicators


# --- Conditions

def sellerRegular = SlowK < 20 and MACD_stdev < -1 and dPlus < 15;

def sellerRegular1 = SlowK1 < 20 and MACD_stdev1 < -1 and dPlus1 < 15;
def sellerRegular2 = SlowK2 < 20 and MACD_stdev2 < -1 and dPlus2 < 15;
def sellerRegular3 = SlowK3 < 20 and MACD_stdev3 < -1 and dPlus3 < 15;
def sellerRegular4 = SlowK4 < 20 and MACD_stdev4 < -1 and dPlus4 < 15;

def sellerExtreme = SlowK < 20 and MACD_stdev < -2 and dPlus < 15;

def sellerExtreme1 = SlowK1 < 20 and MACD_stdev1 < -2 and dPlus1 < 15;
def sellerExtreme2 = SlowK2 < 20 and MACD_stdev2 < -2 and dPlus2 < 15;
def sellerExtreme3 = SlowK3 < 20 and MACD_stdev3 < -2 and dPlus3 < 15;
def sellerExtreme4 = SlowK4 < 20 and MACD_stdev4 < -2 and dPlus4 < 15;

def buyerRegular = SlowK > 80 and MACD_stdev > 1 and dMinus < 15;
 
def buyerRegular1 = SlowK1 > 80 and MACD_stdev1 > 1 and dMinus1 < 15;
def buyerRegular2 = SlowK2 > 80 and MACD_stdev2 > 1 and dMinus2 < 15;
def buyerRegular3 = SlowK3 > 80 and MACD_stdev3 > 1 and dMinus3 < 15;
def buyerRegular4 = SlowK4 > 80 and MACD_stdev4 > 1 and dMinus4 < 15;

def buyerExtreme = SlowK > 80 and MACD_stdev > 2 and dMinus < 15;

def buyerExtreme1 = SlowK1 > 80 and MACD_stdev1 > 2 and dMinus1 < 15;
def buyerExtreme2 = SlowK2 > 80 and MACD_stdev2 > 2 and dMinus2 < 15;
def buyerExtreme3 = SlowK3 > 80 and MACD_stdev3 > 2 and dMinus3 < 15;
def buyerExtreme4 = SlowK4 > 80 and MACD_stdev4 > 2 and dMinus4 < 15;


def priceJump = if close[1] > (open[5] + open[5] * percentGain) then 1 else 0;

# --- End Conditions

# calc vertical placement for arrows
#def arrow3dwn = if !x3d then na else high + (.001 * high);
#def arrow2dwn = if !x2d then na else high + (.0005 * high);
#def arrow1dwn = if !x1d then na else high + (.0001 * high);

#def arrow1up = if !x1u then na else low - (.0001 * high);
#def arrow2up = if !x2u then na else low - (.0005 * high);
#def arrow3up = if !x3u then na else low - (.001 * high);


declare once_per_bar;

input LW1 = 2;
input LW2 = 2;
input LW3 = 2;
input LW4 = 2;

# define distance away from low/high to plot signal
def AvgBarHeight_LN = Power(Double.E, Average(Log(Max(high - low, TickSize())), 5));

def AvgBarHeight = Average(Max(high - low, TickSize()), 5);

#plot graph_BarInfo_Up = AvgBarHeight_LN;
#graph_BarInfo_Up.SetPaintingStrategy(PaintingStrategy.arrow_down);

#plot graph_BarInfo_Dn = AvgBarHeight;
#graph_BarInfo_Dn.SetPaintingStrategy(PaintingStrategy.arrow_up);

#+ (.001 * high);
#def arrow2dwn = if !x2d then na else high + (.0005 * high);
#def arrow1dwn = if !x1d then na else high + (.0001 * high);

# --- Plot

plot RegularBuy = if sellerRegular[1] and !sellerRegular then low else Double.NaN;
plot ExtremeBuy = if sellerExtreme[1] and !sellerExtreme then  low else Double.NaN;
plot RegularSell = if buyerRegular[1] and !buyerRegular then high  else Double.NaN;
plot ExtremeSell = if buyerExtreme[1] and !buyerExtreme then high else Double.NaN;

plot RegularBuy1 = if sellerRegular1[1] and !sellerRegular1 then low else Double.NaN;
plot ExtremeBuy1 = if sellerExtreme1[1] and !sellerExtreme1 then low else Double.NaN;
plot RegularSell1 = if buyerRegular1[1] and !buyerRegular1 then high else Double.NaN;
plot ExtremeSell1 = if buyerExtreme1[1] and !buyerExtreme1 then high else Double.NaN;

plot RegularBuy2 = if sellerRegular2[1] and !sellerRegular2 then low else Double.NaN;
plot ExtremeBuy2 = if sellerExtreme2[1] and !sellerExtreme2 then low else Double.NaN;
plot RegularSell2 = if buyerRegular2[1] and !buyerRegular2 then high else Double.NaN;
plot ExtremeSell2 = if buyerExtreme2[1] and !buyerExtreme2 then high else Double.NaN;

plot RegularBuy3 = if sellerRegular3[1] and !sellerRegular3 then low else Double.NaN;
plot ExtremeBuy3 = if sellerExtreme3[1] and !sellerExtreme3 then low else Double.NaN;
plot RegularSell3 = if buyerRegular3[1] and !buyerRegular3 then high else Double.NaN;
plot ExtremeSell3 = if buyerExtreme3[1] and !buyerExtreme3 then high else Double.NaN;

plot RegularBuy4 = if sellerRegular4[1] and !sellerRegular4 then low else Double.NaN;
plot ExtremeBuy4 = if sellerExtreme4[1] and !sellerExtreme4 then low else Double.NaN;
plot RegularSell4 = if buyerRegular4[1] and !buyerRegular4 then high else Double.NaN;
plot ExtremeSell4 = if buyerExtreme4[1] and !buyerExtreme4 then high else Double.NaN;

# --- Arrows

#RegularBuy.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
#ExtremeBuy.SetPaintingSTrategy(paintingSTrategy.Arrow_UP);
#RegularSell.SetPaintingStrategy(PaintingSTrategy.ARROW_down);
#ExtremeSell.SetPaintingSTrategy(paintingSTrategy.Arrow_DOWN);

#RegularBuy1.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
#ExtremeBuy1.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
#RegularSell1.SetPaintingStrategy(PaintingSTrategy.ARROW_down);
#ExtremeSell1.SetPaintingSTrategy(paintingSTrategy.Arrow_DOWN);

AddVerticalLine(RegularBuy1,  "                               1", Color.Green, curve.short_DASH);
AddVerticalLine(ExtremeBuy1,  "                               1X", Color.Green, curve.short_DASH);
AddVerticalLine(RegularSell1, "                               1", Color.Red, curve.short_DASH);
AddVerticalLine(ExtremeSell1, "                               1X", Color.Red, curve.short_DASH);


#RegularBuy2.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
#ExtremeBuy2.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
#RegularSell2.SetPaintingStrategy(PaintingSTrategy.ARROW_down);
#ExtremeSell2.SetPaintingSTrategy(paintingSTrategy.Arrow_DOWN);

AddVerticalLine(RegularBuy2,  "                               2", Color.Green, curve.firm);
AddVerticalLine(ExtremeBuy2,  "                               2X", Color.Green, curve.firm);
AddVerticalLine(RegularSell2, "                               2", Color.Red, curve.firm);
AddVerticalLine(ExtremeSell2, "                               2X", Color.Red, curve.firm);


#RegularBuy3.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
#ExtremeBuy3.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
#RegularSell3.SetPaintingStrategy(PaintingSTrategy.ARROW_down);
#ExtremeSell3.SetPaintingSTrategy(paintingSTrategy.Arrow_DOWN);

AddVerticalLine(RegularBuy3,  "                               3", Color.Green, curve.LONG_DASH);
AddVerticalLine(ExtremeBuy3,  "                               3X", Color.Green, curve.LONG_DASH);
AddVerticalLine(RegularSell3, "                               3", Color.Red, curve.LONG_DASH);
AddVerticalLine(ExtremeSell3, "                               3X", Color.red, curve.LONG_DASH);

#RegularSell4.SetPaintingStrategy(PaintingSTrategy.ARROW_down);
#ExtremeSell4.SetPaintingSTrategy(paintingSTrategy.Arrow_DOWN);
#RegularBuy4.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
#ExtremeBuy4.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);

AddVerticalLine(RegularBuy4,  "                               4", Color.Green, curve.FIRM);
AddVerticalLine(ExtremeBuy4,  "                               4X", Color.Green, curve.FIRM);
AddVerticalLine(RegularSell4, "                               4", Color.Light_Red, curve.FIRM);
AddVerticalLine(ExtremeSell4, "                               4X", Color.Light_Red, curve.FIRM);

RegularBuy1.Setlineweight(LW1);
ExtremeBuy1.Setlineweight(LW1);
RegularSell1.Setlineweight(LW1);
ExtremeSell1.Setlineweight(LW1);

RegularBuy2.Setlineweight(LW2);
ExtremeBuy2.Setlineweight(LW2);
RegularSell2.Setlineweight(LW2);
ExtremeSell2.Setlineweight(LW2);

RegularBuy3.Setlineweight(LW3);
ExtremeBuy3.Setlineweight(LW3);
RegularSell3.Setlineweight(LW3);
ExtremeSell3.Setlineweight(LW3);

RegularBuy4.Setlineweight(LW4);
ExtremeBuy4.Setlineweight(LW4);
RegularSell4.Setlineweight(LW4);
ExtremeSell4.Setlineweight(LW4);
# --- Default Colors

#RegularBuy.SetDefaultColor(Color.Green);
#ExtremeBuy.SetDefaultColor(Color.Red);
#RegularSell.SetDefaultColor(Color.Green);
#ExtremeSell.SetDefaultColor(Color.Red);

RegularBuy1.SetDefaultColor(CreateColor(0, 205, 1));
ExtremeBuy1.SetDefaultColor(CreateColor(102, 255, 135));
RegularSell1.SetDefaultColor(CreateColor(205, 0, 1));
ExtremeSell1.SetDefaultColor(CreateColor(205, 51, 51));

RegularBuy2.SetDefaultColor(CreateColor(0, 155, 1));
ExtremeBuy2.SetDefaultColor(CreateColor(102, 255, 105));
RegularSell2.SetDefaultColor(CreateColor(155, 0, 1));
ExtremeSell2.SetDefaultColor(CreateColor(155, 51, 51));

RegularBuy3.SetDefaultColor(CreateColor(0, 105, 1));
ExtremeBuy3.SetDefaultColor(CreateColor(102, 255, 75));
RegularSell3.SetDefaultColor(CreateColor(105, 0, 1));
ExtremeSell3.SetDefaultColor(CreateColor(105, 51, 51));

RegularBuy4.SetDefaultColor(Color.Gray);
ExtremeBuy4.SetDefaultColor(Color.Light_red);
RegularSell4.SetDefaultColor(Color.Gray);
ExtremeSell4.SetDefaultColor(Color.Light_Red);



# --- Bubbles

#AddChartBubble((RegularBuy and ExtremeBuy), low, "Buy", Color.Dark_green, no);
#AddChartBubble((RegularSell and ExtremeSell), High, "Sell", Color.Dark_red, no);
#AddChartBubble((RegularSell and ExtremeSell)and ExtremeSell1[5], High, "Sell", Color.Dark_red, no);

# -- Price Color

AssignPriceColor( if paintBars and sellerExtreme then Color.Dark_red else if buyerExtreme and paintBars then Color.GREEN else if paintBars and sellerRegular then Color.red else if buyerRegular and paintBars then Color.DARK_GREEN else if paintBars and sellerExtreme1 then Color.Dark_red else if buyerExtreme1 and paintBars then Color.GREEN else if paintBars and sellerRegular1 then Color.red else if buyerRegular1 and paintBars then Color.DARK_GREEN else if paintBars and sellerExtreme2 then Color.Dark_red else if buyerExtreme2 and paintBars then Color.GREEN else if paintBars and sellerRegular2 then Color.red else if buyerRegular2 and paintBars then Color.DARK_GREEN else if paintBars and sellerExtreme3 then Color.Dark_red else if buyerExtreme3 and paintBars then Color.Green else if paintBars and sellerRegular3 then Color.red else if buyerRegular3 and paintBars then Color.Light_GREEN else if paintBars and sellerExtreme4 then Color.Dark_Red else if buyerExtreme4 and paintBars then Color.GREEN else if paintBars and sellerRegular4 then Color.red else if buyerRegular4 and paintBars then Color.DARK_GREEN else if paintBars then Color.GRAY else Color.current);

# -- Labels

#AddLabel(yes, if buyerRegular[2] and  !buyerRegular[1] then "TF: " + currentPeriod/60000 + " min Sell " else if sellerRegular[1] and !sellerRegular then  "TF: " + currentPeriod/60000 + " min Buy " else "TF: " + currentPeriod/60000 + " min",  if buyerRegular[2] and  !buyerRegular[1] then Color.RED else if  sellerRegular[2] and  !sellerRegular[1] then Color.GREEN else Color.GRAY);

#AddLabel(yes, if buyerRegular1[2] and  !buyerRegular1[1] then "TF: " + agperiod1 + " Sell " else if sellerRegular1[1] and !sellerRegular1 then  "TF: " + agperiod1 + " Buy " else "TF: " + agperiod1,  if buyerRegular1[2] and  !buyerRegular1[1] then Color.RED else if  sellerRegular1[2] and  !sellerRegular1[1] then Color.GREEN else Color.GRAY);

#AddLabel(yes, if buyerRegular2[2] and  !buyerRegular2[1] then "TF: " + agperiod2 + " Sell " else if sellerRegular2[1] and !sellerRegular2 then  "TF: " + agperiod2 + " Buy " else "TF: " + agperiod2,  if buyerRegular2[2] and  !buyerRegular2[1] then Color.RED else if  sellerRegular2[2] and  !sellerRegular2[1] then Color.GREEN else Color.GRAY);

#AddLabel(yes, if buyerRegular3[2] and  !buyerRegular3[1] then "TF: " + agperiod3 + " Sell " else if sellerRegular3[1] and !sellerRegular3 then  "TF: " + agperiod3 + " Buy " else "TF: " + agperiod3,  if buyerRegular3[2] and  !buyerRegular3[1] then Color.RED else if  sellerRegular3[2] and  !sellerRegular3[1] then Color.GREEN else Color.GRAY);

#AddLabel(yes, if buyerRegular4[2] and  !buyerRegular4[1] then "TF: " + agperiod4 + " Sell " else if sellerRegular4[1] and !sellerRegular4 then  "TF: " + agperiod4 + " Buy " else "TF: " + agperiod4,  if buyerRegular4[2] and  !buyerRegular4[1] then Color.RED else if  sellerRegular4[2] and  !sellerRegular4[1] then Color.GREEN else Color.GRAY);

#AddLabel(yes, if buyerExtreme[2] and  !buyerExtreme[1] then "TF: " + currentPeriod/60000 + " min Sell " else if sellerExtreme[1] and !sellerExtreme then  "TF: " + currentPeriod/60000 + " min Buy " else "TF: " + currentPeriod/60000 + " min",  if buyerExtreme[2] and  !buyerExtreme[1] then Color.RED else if  sellerExtreme[2] and  !sellerExtreme[1] then Color.GREEN else Color.GRAY);

#AddLabel(yes, if buyerExtreme1[2] and  !buyerExtreme1[1] then "TF: " + agperiod1 + " Sell " else if sellerExtreme1[1] and !sellerExtreme1 then  "TF: " + agperiod1 + " Buy " else "TF: " + agperiod1,  if buyerExtreme1[2] and  !buyerExtreme1[1] then Color.RED else if  sellerExtreme1[2] and  !sellerExtreme1[1] then Color.GREEN else Color.GRAY);

#AddLabel(yes, if buyerExtreme2[2] and  !buyerExtreme2[1] then "TF: " + agperiod2 + " Sell " else if sellerExtreme2[1] and !sellerExtreme2 then  "TF: " + agperiod2 + " Buy " else "TF: " + agperiod2,  if buyerExtreme2[2] and  !buyerExtreme2[1] then Color.RED else if  sellerExtreme2[2] and  !sellerExtreme2[1] then Color.GREEN else Color.GRAY);

#AddLabel(yes, if buyerExtreme3[2] and  !buyerExtreme3[1] then "TF: " + agperiod3 + " Sell " else if sellerExtreme3[1] and !sellerExtreme3 then  "TF: " + agperiod3 + " Buy " else "TF: " + agperiod3,  if buyerExtreme3[2] and  !buyerExtreme3[1] then Color.RED else if  sellerExtreme3[2] and  !sellerExtreme3[1] then Color.GREEN else Color.GRAY);

#AddLabel(yes, if buyerExtreme4[2] and  !buyerExtreme4[1] then "TF: " + agperiod4 + " Sell " else if sellerExtreme4[1] and !sellerExtreme4 then  "TF: " + agperiod4 + " Buy " else "TF: " + agperiod4,  if buyerExtreme4[2] and  !buyerExtreme4[1] then Color.RED else if  sellerExtreme4[2] and  !sellerExtreme4[1] then Color.GREEN else Color.GRAY);

# --- VERTICLE LINE DAILY ---

#AddVerticalLine(( GetDay() <> GetDay()[1]), "", Color.DARK_GRAY, Curve.SHORT_DASH);

#--- END ---
 
Last edited:
This indicator is still fantastic to use, now paired with that PAM indicator and the Trend reversal Ben posted back in 2019. Have had a pretty good success rate when all 3 indicators stack up together.
Which version of triple exhaustion indicator do you use?
 
Anyone can help creating custom watchlist columns for the 4 different trend buy & sell conditions and color them according to study?
Hey Zeek!! Were you able to figure this out? Really interested to see if there is a watchlist by color code...

@zeek
 
Last edited:
triple exhaustion arrows watchlist column

Code:
## Triple Exhaustion Indicator
## WATCHLIST COLUMN FOR ARROWS
##
## 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.green);
ExtremeBuy.SetDefaultColor(Color.Dark_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.red);
ExtremeSell.SetDefaultColor(Color.Dark_red);


# --- Labels#
#AddLabel(showLabels,"SellerRegular",Color.YELLOW);
#AddLabel(showLabels,"SellerExtreme",Color.CYAN);
#AddLabel(showLabels,"BuyerRegular",Color.DARK_GREEN);
#AddLabel(showLabels,"BuyerExtreme",Color.GREEN);
#Addlabel (yes,  "3X EXH:", Color.Gray);
#Addlabel (yes, if sellerExtreme then "  " else
 #              if buyerExtreme then "  " else
 #              if sellerRegular then "  " else
 #              if buyerRegular then "  " else
 #              if sellerExtreme then "  " else "  ",
 #              if buyerExtreme then Color.MAGENTA else
 #              if sellerRegular then Color.GREEN else
 #              if buyerRegular then Color.RED else
 #              if sellerExtreme then Color.Cyan else
 #              Color.yellow);
#Addlabel (yes, " 3X ARW: ", Color.Gray);
addLabel (yes, if buyerRegular[1]  and !buyerRegular within 3 bars then "3X" else
               if sellerRegular[1] and !sellerRegular within 3 bars then "3X" else
               if buyerExtreme[1]  and !buyerExtreme within 3 bars then "3XT" else
               if sellerExtreme[1] and !sellerExtreme within 3 bars then "3XT" else "  ");

AssignbackgroundColor(
               if buyerRegular[1]  and !buyerRegular within 3 bars then Color.Dark_Green else
               if sellerRegular[1] and !sellerRegular within 3 bars then  Color.Dark_Red else
               if buyerExtreme[1]  and !buyerExtreme within 3 bars then Color.green else
               if sellerExtreme[1] and !sellerExtreme within 3 bars then  Color.red else
                  Color.gray);
 
I added "blast off" and "vix alert 4" to triple exhaustion... i mostly use it on the daily but works on any timeframe... its awesome check it out.

http://tos.mx/d2cOmf4
Code:
## Blast off indicator combined with Triple Exhaustion and vix fix 12/23/22
#
## 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;
input AtrMult = 1.0;
input nATR = 4;
input AvgType = AverageType.HULL;
input trig = 20;

input pd = 22;
input bbl = 20;
input mult = 2.0;
input lb = 50;
input ph = 0.85;
input pl = 1.01;

# Downtrend Criterias

input ltLB = 40;
input mtLB = 14;
input str = 3;


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

# --- From Blast off Indicator
def ATR = MovingAverage(AvgType, TrueRange(high, close, low), nATR);
def UP = HL2 + (AtrMult * ATR);
def DN = HL2 + (-AtrMult * ATR);
def ST = if close < ST[1] then UP else DN;
def SuperTrend = ST;
# --- End Blast off

# --- From Blast off Indicator 2
def val = AbsValue(close - open);
def range = high - low;
def blastOffVal = (val / range) * 100;
def trigger = trig;
def alert1 = blastOffVal < trig;
def col = blastOffVal < trig;
def blast_candle = blastOffVal < trig;
# --- End Blast off 2
# Williams Vix Fix Formula

def wvf = ((highest(close, pd) - low) / (highest(close, pd))) * 100;
def sDev = mult * stdev(wvf, bbl);
def midLine = SimpleMovingAvg(wvf, bbl);
def lowerBand = midLine - sDev;
def upperBand = midLine + sDev;
def rangeHigh = (highest(wvf, lb)) * ph;

#  Filtered Bar Criteria

def upRange = low > low[1] and close > high[1];
def upRange_Aggr = close > close[1] and close > open[1];

#  Filtered Criteria

def filtered = ((wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and(wvf<upperBand and wvf<rangeHigh));
def filtered_Aggr = (wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]);

# Alerts Criteria

def alert_1 = wvf >= upperBand or wvf >= rangeHigh;
def alert_2 = (wvf[1] >= upperBand[1] or wvf[1] >= rangeHigh[1]) and (wvf < upperBand and wvf < rangeHigh);
def alert3 = upRange and close > close[str] and (close < close[ltLB] or close < close[mtLB]) and filtered;
def alert4 = upRange_Aggr and close > close[str] and (close < close[ltLB] or close < close[mtLB]) and filtered_Aggr;

# --- 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;
def RegularBuy1 = if sellerRegular[1] and !sellerRegular then low else Double.NaN;
def ExtremeBuy1 = if sellerExtreme[1] and !sellerExtreme then low else Double.NaN;
def RegularSell2 = if buyerRegular[1] and !buyerRegular then high else Double.NaN;
def ExtremeSell2 = if buyerExtreme[1] and !buyerExtreme then high else Double.NaN;

plot RegularBuy3 = if (!RegularBuy1 and RegularBuy1[1])and(RegularBuy1[1] and !RegularBuy1) then low else Double.NaN;
RegularBuy3.SetPaintingStrategy((PaintingStrategy.ARROW_UP));
# --- End Conditions

# -- Price Color
AssignPriceColor(if paintBars and sellerExtreme then Color.Dark_Red
else if buyerExtreme and paintBars then Color.Dark_Green
else if paintBars and sellerRegular then Color.Red
else if buyerRegular and paintBars then Color.Light_Green
else if paintBars and close < ST and blastOffVal < trig then Color.Light_gray
else if alert4 then Color.cyan
else if paintBars then Color.Dark_GRAY else Color.CURRENT);

# --- Arrows/Trigger RegularBuy = if sellerRegular[1] and !sellerRegular then low else ;


plot ExtremeBuy = if sellerExtreme[1] and !sellerExtreme then low else Double.NaN;

ExtremeBuy.SetPaintingStrategy(PaintingSTrategy.ARROW_Up);

ExtremeBuy.SetDefaultColor(Color.Dark_Green);


plot ExtremeSell = if buyerExtreme[1] and !buyerExtreme then high else Double.NaN;

ExtremeSell.SetPaintingStrategy(PaintingSTrategy.ARROW_Down);

ExtremeSell.SetDefaultColor(Color.Dark_RED);


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




#
 
I like this Indicator except I changed to to small cyan up/down arrows

Here is the changed code:

## 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
##
##
##Changed to small up/down cyan Arrows by Charles Ricks 5-4-23

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.Exponential;
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


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

RegularBuy.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);

RegularBuy.SetDefaultColor(Color.CYAN);


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

RegularSell.SetPaintingStrategy(PaintingSTrategy.ARROW_Down);

RegularSell.SetDefaultColor(Color.CYAN);
 

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