ProcrastinatingPerfection
Member
Can anyone tell me where is the code for the version illustrated in the 2 pictures are at. Thanks in advance.Yeah this thing shines with heavy price action
Can anyone tell me where is the code for the version illustrated in the 2 pictures are at. Thanks in advance.Yeah this thing shines with heavy price action
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Can anyone tell me where is the code for the version illustrated in the 2 pictures are at. Thanks in advance.
# 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
## added MTF Painted Candles with Extreme as well as arrows (create color arrows working but define color paint candles not working for some reason
declare upper;
### --- 4 Aggregation Periods --- ###
#####################################
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"};
# --- Inputs --- #
input DI_Length = 14;
input over_bought = 80;
input over_sold = 20;
input KPeriod = 10;
input DPeriod = 10;
input averageType = AverageType.SIMPLE;
### --- Ag1 --- ###
input length1 = 900;
### --- Ag2 --- ###
input length2= 900;
### --- Ag3 --- ###
input length3 = 900;
### --- Ag4 --- ###
input length4 = 900;
###########################
input paintBars = yes;
input showLabels = yes;
###########################
def currentPeriod = GetAggregationPeriod();
### --- Ag1 --- ###
def priceH1 = high(period = agperiod1);
def priceL1 = low(period = agperiod1);
def priceC1 = close(period = agperiod1);
### --- Ag2 --- ###
def priceH2 = high(period = agperiod2);
def priceL2 = low(period = agperiod2);
def priceC2 = close(period = agperiod2);
### --- Ag3 --- ###
def priceH3 = high(period = agperiod3);
def priceL3 = low(period = agperiod3);
def priceC3 = close(period = agperiod3);
### --- Ag4 --- ###
def priceH4 = high(period = agperiod4);
def priceL4 = low(period = agperiod4);
def priceC4 = close(period = agperiod4);
###########################
# --- Indicators - StochasticSlow / MACD / MACD StDev / DMI+/-
### --- Ag1 --- ###
def SlowK1 = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH1, priceL1, priceC1, 3, averageType).FullK;
def MACD1 = (ExpAverage(priceC1[1], 12)) - (ExpAverage(priceC1[1], 26));
def priceMean1 = SimpleMovingAvg(MACD1, length1);
def MACD_stdev1 = (MACD1 - priceMean1) / StDev(MACD1, length1);
### --- Ag2 --- ###
def SlowK2 = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH2, priceL2, priceC2, 3, averageType).FullK;
def MACD2 = (ExpAverage(priceC2[1], 12)) - (ExpAverage(priceC2[1], 26));
def priceMean2 = SimpleMovingAvg(MACD2, length2);
def MACD_stdev2 = (MACD2 - priceMean2) / StDev(MACD2, length2);
### --- Ag3 --- ###
def SlowK3 = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH3, priceL3, priceC3, 3, averageType).FullK;
def MACD3 = (ExpAverage(priceC3[1], 12)) - (ExpAverage(priceC3[1], 26));
def priceMean3 = SimpleMovingAvg(MACD3, length3);
def MACD_stdev3 = (MACD3 - priceMean3) / StDev(MACD3, length3);
### --- Ag4 --- ###
def SlowK4 = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH4, priceL4, priceC4, 3, averageType).FullK;
def MACD4 = (ExpAverage(priceC4[1], 12)) - (ExpAverage(priceC4[1], 26));
def priceMean4 = SimpleMovingAvg(MACD4, length4);
def MACD_stdev4 = (MACD4 - priceMean4) / StDev(MACD4, length4);
### --- All --- ###
def dPlus = reference DMI()."DI+";
def dMinus = reference DMI()."DI-";
### --- DMI computations --- ###
### --- Ag1 --- ###
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;
### --- Ag2 --- ###
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;
### --- Ag3 --- ###
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;
### --- Ag4 --- ###
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;
###########################
# --- Conditions
### --- Ag1 --- ###
def sellerRegular1 = SlowK1 < 20 and MACD_stdev1 < -1 and dPlus1 < 15;
def sellerExtreme1 = SlowK1 < 20 and MACD_stdev1 < -2 and dPlus1 < 15;
def buyerRegular1 = SlowK1 > 80 and MACD_stdev1 > 1 and dMinus1 < 15;
def buyerExtreme1 = SlowK1 > 80 and MACD_stdev1 > 2 and dMinus1 < 15;
### --- Ag2 --- ###
def sellerRegular2 = SlowK2 < 20 and MACD_stdev2 < -1 and dPlus2 < 15;
def sellerExtreme2 = SlowK2 < 20 and MACD_stdev2 < -2 and dPlus2 < 15;
def buyerRegular2 = SlowK2 > 80 and MACD_stdev2 > 1 and dMinus2 < 15;
def buyerExtreme2 = SlowK2 > 80 and MACD_stdev2 > 2 and dMinus2 < 15;
### --- Ag3 --- ###
def sellerRegular3 = SlowK3 < 20 and MACD_stdev3 < -1 and dPlus3 < 15;
def sellerExtreme3 = SlowK3 < 20 and MACD_stdev3 < -2 and dPlus3 < 15;
def buyerRegular3 = SlowK3 > 80 and MACD_stdev3 > 1 and dMinus3 < 15;
def buyerExtreme3 = SlowK3 > 80 and MACD_stdev3 > 2 and dMinus3 < 15;
### --- Ag4 --- ###
def sellerRegular4 = SlowK4 < 20 and MACD_stdev4 < -1 and dPlus4 < 15;
def sellerExtreme4 = SlowK4 < 20 and MACD_stdev4 < -2 and dPlus4 < 15;
def buyerRegular4 = SlowK4 > 80 and MACD_stdev4 > 1 and dMinus4 < 15;
def buyerExtreme4 = SlowK4 > 80 and MACD_stdev4 > 2 and dMinus4 < 15;
###########################
### --- Plot Arrows --- ###
### --- Ag1 --- ###
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;
### --- Ag2 --- ###
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;
### --- Ag3 --- ###
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;
### --- Ag4 --- ###
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 --- ###
### --- Ag1 --- ###
RegularBuy1.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
ExtremeBuy1.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
RegularSell1.SetPaintingStrategy(PaintingSTrategy.ARROW_down);
ExtremeSell1.SetPaintingSTrategy(paintingSTrategy.Arrow_DOWN);
### --- Ag2 --- ###
RegularBuy2.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
ExtremeBuy2.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
RegularSell2.SetPaintingStrategy(PaintingSTrategy.ARROW_down);
ExtremeSell2.SetPaintingSTrategy(paintingSTrategy.Arrow_DOWN);
### --- Ag3 --- ###
RegularBuy3.SetPaintingStrategy(paintingSTrategy.triangles);
ExtremeBuy3.SetPaintingStrategy(paintingSTrategy.triangles);
RegularSell3.SetPaintingStrategy(paintingSTrategy.triangles);
ExtremeSell3.SetPaintingSTrategy(paintingSTrategy.triangles);
### --- Ag4 --- ###
RegularSell4.SetPaintingStrategy(PaintingSTrategy.ARROW_down);
ExtremeSell4.SetPaintingSTrategy(paintingSTrategy.Arrow_DOWN);
RegularBuy4.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
ExtremeBuy4.SetPaintingStrategy(PaintingSTrategy.ARROW_UP);
### --- Color --- ###
### --- Ag1 --- ###
RegularBuy1.SetDefaultColor(CreateColor(0, 205, 1));
ExtremeBuy1.SetDefaultColor(CreateColor(102, 255, 135));
RegularSell1.SetDefaultColor(CreateColor(205, 0, 1));
ExtremeSell1.SetDefaultColor(CreateColor(205, 51, 51));
### --- Ag2 --- ###
RegularBuy2.SetDefaultColor(CreateColor(0, 155, 1));
ExtremeBuy2.SetDefaultColor(CreateColor(102, 255, 105));
RegularSell2.SetDefaultColor(CreateColor(155, 0, 1));
ExtremeSell2.SetDefaultColor(CreateColor(155, 51, 51));
### --- Ag3 --- ###
RegularBuy3.SetDefaultColor(CreateColor(0, 105, 1));
ExtremeBuy3.SetDefaultColor(CreateColor(102, 255, 75));
RegularSell3.SetDefaultColor(CreateColor(105, 0, 1));
ExtremeSell3.SetDefaultColor(CreateColor(105, 51, 51));
### --- Ag4 --- ###
#RegularBuy4.SetDefaultColor(CreateColor(0, 55, 1));
#ExtremeBuy4.SetDefaultColor(CreateColor(102, 255, 45));
#RegularSell4.SetDefaultColor(CreateColor(55, 0, 1));
#ExtremeSell4.SetDefaultColor(CreateColor(55, 51, 51));
### --- Ag4 --- ###
RegularBuy4.SetDefaultColor(Color.White);
ExtremeBuy4.SetDefaultColor(Color.Gray);
RegularSell4.SetDefaultColor(Color.White);
ExtremeSell4.SetDefaultColor(Color.Gray);
###########################
### Define Color For Price Color (not working) ###
### --- Ag1 --- ###
#RegularBuy1.DefineColor("RegularBuy1",(CreateColor(0, 205, 1)));
#ExtremeBuy1.DefineColor("ExtremeBuy1",(CreateColor(102, 255, 135)));
#RegularSell1.DefineColor("RegularSell1",(CreateColor(205, 0, 1)));
#ExtremeSell1.DefineColor("ExtremeSell1",(CreateColor(205, 51, 51)));
### --- Ag2 --- ###
#RegularBuy2.DefineColor("RegularBuy2",(CreateColor(0, 155, 1)));
#ExtremeBuy2.DefineColor("ExtremeBuy2",(CreateColor(102, 255, 105)));
#RegularSell2.DefineColor("RegularSell2",(CreateColor(155, 0, 1)));
#ExtremeSell2.DefineColor("ExtremeSell2",(CreateColor(155, 51, 51)));
### --- Ag3 --- ###
#RegularBuy3.DefineColor("RegularBuy3",(CreateColor(0, 105, 1)));
#ExtremeBuy3.DefineColor("ExtremeBuy3",(CreateColor(102, 255, 75)));
#RegularSell3.DefineColor("RegularSell3",(CreateColor(105, 0, 1)));
#ExtremeSell3.DefineColor("ExtremeSell3",(CreateColor(105, 51, 51)));
### --- Ag4 --- ###
#RegularBuy4.DefineColor("RegularBuy4",(CreateColor(0, 55, 1)));
#ExtremeBuy4.DefineColor("ExtremeBuy4",(CreateColor(102, 255, 45)));
#RegularSell4.DefineColor("RegularSell4",(CreateColor(55, 0, 1)));
#ExtremeSell4.DefineColor("ExtremeSell4",(CreateColor(55, 51, 51)));
###########################
### Price Color ###
AssignPriceColor( if paintBars and sellerExtreme1 then Color.Downtick
else if buyerExtreme1 and paintBars then Color.Lime
else if paintBars and sellerRegular1 then Color.Downtick
else if buyerRegular1 and paintBars then Color.Lime
else if paintBars and sellerExtreme2 then Color.Light_red
else if buyerExtreme2 and paintBars then Color.Light_GREEN
else if paintBars and sellerRegular2 then Color.Light_red
else if buyerRegular2 and paintBars then Color.Light_GREEN
else if paintBars and sellerExtreme3 then Color.red
else if buyerExtreme3 and paintBars then Color.Green
else if paintBars and sellerRegular3 then Color.red
else if buyerRegular3 and paintBars then Color.GREEN
else if paintBars and sellerExtreme4 then Color.Dark_Red
else if buyerExtreme4 and paintBars then Color.Dark_GREEN
else if paintBars and sellerRegular4 then Color.Dark_red
else if buyerRegular4 and paintBars then Color.DARK_GREEN
else if paintBars then Color.GRAY else Color.Current);
### NOT WORKING PRICE COLOR? ####
#AssignPriceColor(
# if paintBars and sellerExtreme1 then ExtremeSell1.Color("ExtremeSell")
#else if buyerExtreme1 and paintBars then ExtremeBuy1.Color("ExtremeBuy")
#else if paintBars and sellerRegular1 then RegularSell1.Color("RegularSell")
#else if buyerRegular1 and paintBars then RegularBuy1.Color("RegularBuy")
#else if paintBars and sellerExtreme2 then ExtremeSell2.Color("ExtremeSell")
#else if buyerExtreme2 and paintBars then ExtremeBuy2.Color("ExtremeBuy")
#else if paintBars and sellerRegular2 then RegularSell2.Color("RegularSell")
#else if buyerRegular2 and paintBars then RegularBuy2.Color("RegularBuy")
#else if paintBars and sellerExtreme3 then ExtremeSell3.Color("ExtremeSell")
#else if buyerExtreme3 and paintBars then ExtremeBuy3.Color("ExtremeBuy")
#else if paintBars and sellerRegular3 then RegularSell3.Color("RegularSell")
#else if buyerRegular3 and paintBars then RegularBuy3.Color("RegularBuy")
#else if paintBars and sellerExtreme4 then ExtremeSell4.Color("ExtremeSell")
#else if buyerExtreme4 and paintBars then ExtremeBuy4.Color("ExtremeBuy")
#else if paintBars and sellerRegular4 then RegularSell4.Color("RegularSell")
#else if buyerRegular4 and paintBars then RegularBuy4.Color("RegularBuy")
#else if paintBars then Color.GRAY else Color.Current);
###########################
# --- VERTICLE LINE DAILY --- #
AddVerticalLine(( GetDay() <> GetDay()[1]), "", Color.DARK_GRAY, Curve.SHORT_DASH);
#--- END ---
i'm getting an error. please helpI am working on the "Triple Exhaustion MTF" study. Added Extreme Buy and Sell. I coded the price color (with the custom colors) wrong apparently as they are not working... however the candle painting without custom colors works fine and the custom color arrows work as well... not sure where i went wrong. It was my intent to make the higher aggregation a vertical cloud similar to a screenshot posted earlier in the thread but have not figured it out yet. Anyway here is the share link and code.
![]()
http://tos.mx/KSDA6QJ
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 ## added MTF Painted Candles with Extreme as well as arrows (create color arrows working but define color paint candles not working for some reason declare upper; ### --- 4 Aggregation Periods --- ### ##################################### 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"}; # --- Inputs --- # input DI_Length = 14; input over_bought = 80; input over_sold = 20; input KPeriod = 10; input DPeriod = 10; input averageType = AverageType.SIMPLE; ### --- Ag1 --- ### input length1 = 900; ### --- Ag2 --- ### input length2= 900; ### --- Ag3 --- ### input length3 = 900; ### --- Ag4 --- ### input length4 = 900; ########################### input paintBars = yes; input showLabels = yes; ########################### def currentPeriod = GetAggregationPeriod(); ### --- Ag1 --- ### def priceH1 = high(period = agperiod1); def priceL1 = low(period = agperiod1); def priceC1 = close(period = agperiod1); ### --- Ag2 --- ### def priceH2 = high(period = agperiod2); def priceL2 = low(period = agperiod2); def priceC2 = close(period = agperiod2); ### --- Ag3 --- ### def priceH3 = high(period = agperiod3); def priceL3 = low(period = agperiod3); def priceC3 = close(period = agperiod3); ### --- Ag4 --- ### def priceH4 = high(period = agperiod4); def priceL4 = low(period = agperiod4); def priceC4 = close(period = agperiod4); ########################### # --- Indicators - StochasticSlow / MACD / MACD StDev / DMI+/- ### --- Ag1 --- ### def SlowK1 = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH1, priceL1, priceC1, 3, averageType).FullK; def MACD1 = (ExpAverage(priceC1[1], 12)) - (ExpAverage(priceC1[1], 26)); def priceMean1 = SimpleMovingAvg(MACD1, length1); def MACD_stdev1 = (MACD1 - priceMean1) / StDev(MACD1, length1); ### --- Ag2 --- ### def SlowK2 = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH2, priceL2, priceC2, 3, averageType).FullK; def MACD2 = (ExpAverage(priceC2[1], 12)) - (ExpAverage(priceC2[1], 26)); def priceMean2 = SimpleMovingAvg(MACD2, length2); def MACD_stdev2 = (MACD2 - priceMean2) / StDev(MACD2, length2); ### --- Ag3 --- ### def SlowK3 = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH3, priceL3, priceC3, 3, averageType).FullK; def MACD3 = (ExpAverage(priceC3[1], 12)) - (ExpAverage(priceC3[1], 26)); def priceMean3 = SimpleMovingAvg(MACD3, length3); def MACD_stdev3 = (MACD3 - priceMean3) / StDev(MACD3, length3); ### --- Ag4 --- ### def SlowK4 = reference StochasticFull(over_bought, over_sold, KPeriod, DPeriod, priceH4, priceL4, priceC4, 3, averageType).FullK; def MACD4 = (ExpAverage(priceC4[1], 12)) - (ExpAverage(priceC4[1], 26)); def priceMean4 = SimpleMovingAvg(MACD4, length4); def MACD_stdev4 = (MACD4 - priceMean4) / StDev(MACD4, length4); ### --- All --- ### def dPlus = reference DMI()."DI+"; def dMinus = reference DMI()."DI-"; ### --- DMI computations --- ### ### --- Ag1 --- ### 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; ### --- Ag2 --- ### 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; ### --- Ag3 --- ### 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; ### --- Ag4 --- ### 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; ########################### # --- Conditions ### --- Ag1 --- ### def sellerRegular1 = SlowK1 < 20 and MACD_stdev1 < -1 and dPlus1 < 15; def sellerExtreme1 = SlowK1 < 20 and MACD_stdev1 < -2 and dPlus1 < 15; def buyerRegular1 = SlowK1 > 80 and MACD_stdev1 > 1 and dMinus1 < 15; def buyerExtreme1 = SlowK1 > 80 and MACD_stdev1 > 2 and dMinus1 < 15; ### --- Ag2 --- ### def sellerRegular2 = SlowK2 < 20 and MACD_stdev2 < -1 and dPlus2 < 15; def sellerExtreme2 = SlowK2 < 20 and MACD_stdev2 < -2 and dPlus2 < 15; def buyerRegular2 = SlowK2 > 80 and MACD_stdev2 > 1 and dMinus2 < 15; def buyerExtreme2 = SlowK2 > 80 and MACD_stdev2 > 2 and dMinus2 < 15; ### --- Ag3 --- ### def sellerRegular3 = SlowK3 < 20 and MACD_stdev3 < -1 and dPlus3 < 15; def sellerExtreme3 = SlowK3 < 20 and MACD_stdev3 < -2 and dPlus3 < 15; def buyerRegular3 = SlowK3 > 80 and MACD_stdev3 > 1 and dMinus3 < 15; def buyerExtreme3 = SlowK3 > 80 and MACD_stdev3 > 2 and dMinus3 < 15; ### --- Ag4 --- ### def sellerRegular4 = SlowK4 < 20 and MACD_stdev4 < -1 and dPlus4 < 15; def sellerExtreme4 = SlowK4 < 20 and MACD_stdev4 < -2 and dPlus4 < 15; def buyerRegular4 = SlowK4 > 80 and MACD_stdev4 > 1 and dMinus4 < 15; def buyerExtreme4 = SlowK4 > 80 and MACD_stdev4 > 2 and dMinus4 < 15; ########################### ### --- Plot Arrows --- ### ### --- Ag1 --- ### 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; ### --- Ag2 --- ### 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; ### --- Ag3 --- ### 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; ### --- Ag4 --- ### 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 --- ### ### --- Ag1 --- ### RegularBuy1.SetPaintingStrategy(PaintingSTrategy.ARROW_UP); ExtremeBuy1.SetPaintingStrategy(PaintingSTrategy.ARROW_UP); RegularSell1.SetPaintingStrategy(PaintingSTrategy.ARROW_down); ExtremeSell1.SetPaintingSTrategy(paintingSTrategy.Arrow_DOWN); ### --- Ag2 --- ### RegularBuy2.SetPaintingStrategy(PaintingSTrategy.ARROW_UP); ExtremeBuy2.SetPaintingStrategy(PaintingSTrategy.ARROW_UP); RegularSell2.SetPaintingStrategy(PaintingSTrategy.ARROW_down); ExtremeSell2.SetPaintingSTrategy(paintingSTrategy.Arrow_DOWN); ### --- Ag3 --- ### RegularBuy3.SetPaintingStrategy(paintingSTrategy.triangles); ExtremeBuy3.SetPaintingStrategy(paintingSTrategy.triangles); RegularSell3.SetPaintingStrategy(paintingSTrategy.triangles); ExtremeSell3.SetPaintingSTrategy(paintingSTrategy.triangles); ### --- Ag4 --- ### RegularSell4.SetPaintingStrategy(PaintingSTrategy.ARROW_down); ExtremeSell4.SetPaintingSTrategy(paintingSTrategy.Arrow_DOWN); RegularBuy4.SetPaintingStrategy(PaintingSTrategy.ARROW_UP); ExtremeBuy4.SetPaintingStrategy(PaintingSTrategy.ARROW_UP); ### --- Color --- ### ### --- Ag1 --- ### RegularBuy1.SetDefaultColor(CreateColor(0, 205, 1)); ExtremeBuy1.SetDefaultColor(CreateColor(102, 255, 135)); RegularSell1.SetDefaultColor(CreateColor(205, 0, 1)); ExtremeSell1.SetDefaultColor(CreateColor(205, 51, 51)); ### --- Ag2 --- ### RegularBuy2.SetDefaultColor(CreateColor(0, 155, 1)); ExtremeBuy2.SetDefaultColor(CreateColor(102, 255, 105)); RegularSell2.SetDefaultColor(CreateColor(155, 0, 1)); ExtremeSell2.SetDefaultColor(CreateColor(155, 51, 51)); ### --- Ag3 --- ### RegularBuy3.SetDefaultColor(CreateColor(0, 105, 1)); ExtremeBuy3.SetDefaultColor(CreateColor(102, 255, 75)); RegularSell3.SetDefaultColor(CreateColor(105, 0, 1)); ExtremeSell3.SetDefaultColor(CreateColor(105, 51, 51)); ### --- Ag4 --- ### #RegularBuy4.SetDefaultColor(CreateColor(0, 55, 1)); #ExtremeBuy4.SetDefaultColor(CreateColor(102, 255, 45)); #RegularSell4.SetDefaultColor(CreateColor(55, 0, 1)); #ExtremeSell4.SetDefaultColor(CreateColor(55, 51, 51)); ### --- Ag4 --- ### RegularBuy4.SetDefaultColor(Color.White); ExtremeBuy4.SetDefaultColor(Color.Gray); RegularSell4.SetDefaultColor(Color.White); ExtremeSell4.SetDefaultColor(Color.Gray); ########################### ### Define Color For Price Color (not working) ### ### --- Ag1 --- ### #RegularBuy1.DefineColor("RegularBuy1",(CreateColor(0, 205, 1))); #ExtremeBuy1.DefineColor("ExtremeBuy1",(CreateColor(102, 255, 135))); #RegularSell1.DefineColor("RegularSell1",(CreateColor(205, 0, 1))); #ExtremeSell1.DefineColor("ExtremeSell1",(CreateColor(205, 51, 51))); ### --- Ag2 --- ### #RegularBuy2.DefineColor("RegularBuy2",(CreateColor(0, 155, 1))); #ExtremeBuy2.DefineColor("ExtremeBuy2",(CreateColor(102, 255, 105))); #RegularSell2.DefineColor("RegularSell2",(CreateColor(155, 0, 1))); #ExtremeSell2.DefineColor("ExtremeSell2",(CreateColor(155, 51, 51))); ### --- Ag3 --- ### #RegularBuy3.DefineColor("RegularBuy3",(CreateColor(0, 105, 1))); #ExtremeBuy3.DefineColor("ExtremeBuy3",(CreateColor(102, 255, 75))); #RegularSell3.DefineColor("RegularSell3",(CreateColor(105, 0, 1))); #ExtremeSell3.DefineColor("ExtremeSell3",(CreateColor(105, 51, 51))); ### --- Ag4 --- ### #RegularBuy4.DefineColor("RegularBuy4",(CreateColor(0, 55, 1))); #ExtremeBuy4.DefineColor("ExtremeBuy4",(CreateColor(102, 255, 45))); #RegularSell4.DefineColor("RegularSell4",(CreateColor(55, 0, 1))); #ExtremeSell4.DefineColor("ExtremeSell4",(CreateColor(55, 51, 51))); ########################### ### Price Color ### AssignPriceColor( if paintBars and sellerExtreme1 then Color.Downtick else if buyerExtreme1 and paintBars then Color.Lime else if paintBars and sellerRegular1 then Color.Downtick else if buyerRegular1 and paintBars then Color.Lime else if paintBars and sellerExtreme2 then Color.Light_red else if buyerExtreme2 and paintBars then Color.Light_GREEN else if paintBars and sellerRegular2 then Color.Light_red else if buyerRegular2 and paintBars then Color.Light_GREEN else if paintBars and sellerExtreme3 then Color.red else if buyerExtreme3 and paintBars then Color.Green else if paintBars and sellerRegular3 then Color.red else if buyerRegular3 and paintBars then Color.GREEN else if paintBars and sellerExtreme4 then Color.Dark_Red else if buyerExtreme4 and paintBars then Color.Dark_GREEN else if paintBars and sellerRegular4 then Color.Dark_red else if buyerRegular4 and paintBars then Color.DARK_GREEN else if paintBars then Color.GRAY else Color.Current); ### NOT WORKING PRICE COLOR? #### AssignPriceColor( if paintBars and sellerExtreme1 then ExtremeSell1.Color("ExtremeSell") else if buyerExtreme1 and paintBars then ExtremeBuy1.Color("ExtremeBuy") else if paintBars and sellerRegular1 then RegularSell1.Color("RegularSell1") else if buyerRegular1 and paintBars then RegularBuy1.Color("RegularBuy1") else if paintBars and sellerExtreme1 then ExtremeSell1.Color("ExtremeSell1") else if buyerExtreme1 and paintBars then ExtremeBuy1.Color("ExtremeBuy1") else if paintBars and sellerRegular2 then RegularSell2.Color("RegularSell2") else if buyerRegular2 and paintBars then RegularBuy2.Color("RegularBuy2") else if paintBars and sellerExtreme2 then ExtremeSell2.Color("ExtremeSell2") else if buyerExtreme2 and paintBars then ExtremeBuy2.Color("ExtremeBuy2") else if paintBars and sellerRegular3 then RegularSell3.Color("RegularSell3") else if buyerRegular3 and paintBars then RegularBuy3.Color("RegularBuy3") else if paintBars and sellerExtreme3 then ExtremeSell3.Color("ExtremeSell3") else if buyerExtreme3 and paintBars then ExtremeBuy3.Color("ExtremeBuy3") else if paintBars and sellerRegular4 then RegularSell4.Color("RegularSell4") else if buyerRegular4 and paintBars then RegularBuy4.Color("RegularBuy4") else if paintBars and sellerExtreme4 then ExtremeSell4.Color("ExtremeSell4") else if buyerExtreme4 and paintBars then ExtremeBuy4.Color("ExtremeBuy4") else if paintBars then Color.GRAY else Color.Current); ########################### # --- VERTICLE LINE DAILY --- # AddVerticalLine(( GetDay() <> GetDay()[1]), "", Color.DARK_GRAY, Curve.SHORT_DASH); #--- END ---
Hey sorry you have to put # in front of the “define color” (everything under the # Not working paint candles #)i'm getting an error. please help
I edited it should work now (it will only work on timeframes up to the lowest ag setting)Hey sorry you have to put # in front of the “define color” (everything under the # Not working paint candles #)
I have not tested the MTF version just be aware that the higher aggregations can repaint until the bar for that timeframe closes… but mess with the ag settings and watch before you trade using it… and of course I screenshot an ideal section but it’s not always so perfect.Entries seem great with this. Anyone have a good working set of stop/target signals for the exit?
Try it now.can u drop the code or new TOS link... still not working for me re-copied the code
Yeah I'm pretty comfortable with the entries (it seems to work quite well with the TMO as an example). I'm more wondering about exits. Waiting for the next signal on the other side doesn't seem feasible, as the trend often dies before then. Was thinking PSAR or some kind of ATR-based target and stop system. Just wondering what others are using for risk management and profit taking.I have not tested the MTF version just be aware that the higher aggregations can repaint until the bar for that timeframe closes… but mess with the ag settings and watch before you trade using it… and of course I screenshot an ideal section but it’s not always so perfect.
That being said I use the non MTF version in my setup with
You will likely see more than one indication before reversal unless price action is heavy so when you see the dot or arrow (whichever you will use) as with most indicators it is signaling you to look for entry soon - so confirm entry based on price action, levels, etc.
The following screenshot is from ThinkOrSwim Mobile (if you want to see others go to the “confirmation candles” thread or search my name. I have talked about using triple exhaustion many times there)
The green circles with the light green inside color are “Regular_Buy”
The green circles with the dark green inside color are “Extreme_Buy”
The red circles with the light red inside color are “Regular_Sell”
The red circles with the dark red inside color are “Extreme_Sell”
(Personally I do not value one over the other)
With my setup on low timeframe (non mtf) works very well when viewed in context of my other indicators (C3_Max_Spark etc.)
anyone have the latest code for this Triple Exhaustion Indicator? I copied one above and it does not seem to work.
What code are you using to get those result on the charts??watching the indicator this morning with NQ. After the breakout waited for the down arrow, took the short. I was watching on the 5 min, the 1 min was too busy but it looks like the 3 min might have been better at nailing the top. Update: I think taking the short after a fast breakout will enhance the chance of success.
![]()
![]()
The arrows are from the triple exhaustion studyWhat code are you using to get those result on the charts??
I agree this indicator loves large price action.watching the indicator this morning with NQ. After the breakout waited for the down arrow, took the short. I was watching on the 5 min, the 1 min was too busy but it looks like the 3 min might have been better at nailing the top. Update: I think taking the short after a fast breakout will enhance the chance of success.
![]()
![]()
Would you be willing to share your chart in a link? Thank you, JeffWhat code are you using to get those result on the charts??
Would you be willing to share your Heiken Ashi Chart? Thank you,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 ----------------------------#
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
H | Triple TSI For ThinkOrSwim | Indicators | 13 | |
![]() |
Triple 3 Inside Bars Indicator and Scanner for ThinkorSwim | Indicators | 94 | |
![]() |
4 & 20 Period Historical Volatility - Reversals and Trend Exhaustion | Indicators | 6 | |
![]() |
Leledc Exhaustion Indicator for ThinkorSwim | Indicators | 46 | |
![]() |
Trend Exhaustion Indicator for ThinkorSwim | Indicators | 28 |
Start a new thread and receive assistance from our community.
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.
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.