Custom Indecision Candles for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
I look for these indecision candles on a daily basis (after market close). All of them have been shared on here before but separately. I thought it would be useful just to combine them into one single indicator. Easier to scan for new pattern.
Warning: The arrows and signals in this indicator does not suggest the direction of the stock's movement. They're there solely to point out the patterns.



thinkScript Code

Code:
# Ultimate Indecision Candles
# A collection of indecision candlestick patterns to help identify potential trend reversal
# Assembled by BenTen at usethinkscript.com

## Credits
#https://www.tradingview.com/script/V9Mi6eOO-CM-Blast-Off-V1-Alerts-Ready/
#https://www.tradingview.com/script/zZOCuaJN-Custom-Candle-color-Inside-Outside-candles-Highwave-Star-Patt/
#https://www.tradingview.com/script/LyNzdJVX-Spinning-Tops/
## End Credits

# Blast Off Indicator
input Period = aggregationPeriod.DAY;
input BlastOffArrow = no;
def close = close(period = Period);
def high = high(period = Period);
def open = open(period = Period);
def low = low(period = Period);
input trig = 20;
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;
plot Blast_Off = if BlastOffArrow then col else double.nan;
Blast_Off.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Blast_Off.SetDefaultColor(Color.CYAN);
Blast_Off.SetLineWeight(1);
assignPriceColor(if blastOffVal<trig then Color.MAGENTA else Color.CURRENT);
# End Blast Off

# Spinning top
input stsize = 0.5;
def spinningtop = (open > close) and((high-low)>(3* (open-close))and(((high-open)/(.001+high-low))< stsize)and(((close-low)/(.001+high-low))< stsize)) or(close>open) and((high-low)>(3* (close-open))and(((high-close)/(.001+high-low))< stsize)and(((open-low)/(.001+high-low))< stsize));
plot spinning_top = spinningtop;
spinning_top.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
spinning_top.SetDefaultColor(GetColor(1));
# End Spinnig Top

# Highwave
def Day = (high - low);
def Day_1 = (high[1] - low[1]);
def Day_2 = (high[2] - low[2]);
def Day_3 = (high[3] - low[3]);
def Day_4 = (high[4] - low[4]);
def Day_5 = (high[5] - low[5]);
def Avg = ((Day_1 + Day_2 + Day_3 + Day_4 + Day_5) / 5);
input Highwave_Wick_Multiplier = 3.0;
input Range_Multiplier = 1.0;
def Highwave = (((high - low) - (AbsValue(open - close))) > ((AbsValue(open - close)) * Highwave_Wick_Multiplier)) and((Day > (Avg* Range_Multiplier)));
plot high_wave = Highwave;
high_wave.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
high_wave.SetDefaultColor(GetColor(4));
# End HighWave

# Doji
input Precision = 0.01;
def doji_data = absValue(open - close) <= (high - low) * Precision;

plot doji = doji_data;
doji.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
doji.SetDefaultColor(GetColor(5));
# End Doji

A quick note about the Blast Off pattern: I added a plot for the blast off candlestick pattern in the code. However, the arrow is turned off by default since the candle is already being highlighted in pink. That being said, when you scan for this pattern, be sure to change the setting from No to Yes otherwise, it will return no result.

 
Last edited:
K

Kimberly

New member
I'm not able to get this code to work. There are a couple of areas at the top that are shaded in red. I'm not sure what I'm doing wrong. Can anyone help?
 
T

tomsk

Well-known member
VIP
The following should work better now - there were a couple of lines which ought to have been commented out that were not. Most probably an oversight

Code:
# Ultimate Indecision Candles
# A collection of indecision candlestick patterns to help identify potential trend reversal
# Assembled by BenTen at usethinkscript.com

## Credits
#https://www.tradingview.com/script/V9Mi6eOO-CM-Blast-Off-V1-Alerts-Ready/
#https://www.tradingview.com/script/zZOCuaJN-Custom-Candle-color-Inside-Outside-candles-Highwave-Star-Patt/
#https://www.tradingview.com/script/LyNzdJVX-Spinning-Tops/
## End Credits

# Blast Off Indicator
input Period = aggregationPeriod.DAY;
input BlastOffArrow = no;
def close = close(period = Period);
def high = high(period = Period);
def open = open(period = Period);
def low = low(period = Period);
input trig = 20;
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;
plot Blast_Off = if BlastOffArrow then col else double.nan;
Blast_Off.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Blast_Off.SetDefaultColor(Color.CYAN);
Blast_Off.SetLineWeight(1);
assignPriceColor(if blastOffVal<trig then Color.MAGENTA else Color.CURRENT);
# End Blast Off

# Spinning top
input stsize = 0.5;
def spinningtop = (open > close) and((high-low)>(3* (open-close))and(((high-open)/(.001+high-low))< stsize)and(((close-low)/(.001+high-low))<

stsize)) or(close>open) and((high-low)>(3* (close-open))and(((high-close)/(.001+high-low))< stsize)and(((open-low)/(.001+high-low))< stsize));
plot spinning_top = spinningtop;
spinning_top.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_UP);
spinning_top.SetDefaultColor(GetColor(1));
# End Spinnig Top

# Highwave
def Day = (high - low);
def Day_1 = (high[1] - low[1]);
def Day_2 = (high[2] - low[2]);
def Day_3 = (high[3] - low[3]);
def Day_4 = (high[4] - low[4]);
def Day_5 = (high[5] - low[5]);
def Avg = ((Day_1 + Day_2 + Day_3 + Day_4 + Day_5) / 5);
input Highwave_Wick_Multiplier = 3.0;
input Range_Multiplier = 1.0;
def Highwave = (((high - low) - (AbsValue(open - close))) > ((AbsValue(open - close)) * Highwave_Wick_Multiplier)) and((Day > (Avg*

Range_Multiplier)));
plot high_wave = Highwave;
high_wave.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_DOWN);
high_wave.SetDefaultColor(GetColor(4));
# End HighWave

# Doji
input Precision = 0.01;
def doji_data = absValue(open - close) <= (high - low) * Precision;

plot doji = doji_data;
doji.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
doji.SetDefaultColor(GetColor(5));
# End Doji
 
BenTen

BenTen

Administrative
Staff
VIP
@Kimberly Sorry about that. The code has been updated. That was a silly mistake of mine. Thank you @tomsk for helping.
 

Similar threads

Top