Spinning Tops Candlestick Pattern for ThinkorSwim

BenTen

Administrative
Staff
VIP
The spinning top is a candlestick pattern that shows indecision in the market.

It’s a small candlestick pattern. In this pattern, the stock prices open and close are near each other. This pattern forms when there’s indecision among the buyers and sellers in the uptrend, downtrend, or sideways trend. The pattern suggests a possible change in trend.




thinkScript Code

Code:
# Spinning Top Candlestick Pattern
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/LyNzdJVX-Spinning-Tops/

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

assignPriceColor(if spinningtop then Color.CYAN else Color.WHITE);

A few resources to help you learn more about this pattern:
 

Playstation

Active member
VIP
Hi I'm new! This seems to work very well on oil futures, 5mins. Due to me being partial colour blind, I can't spot colours that well, hence using a white background, with black and hollow candles. Is it possible to change the code "then Color.BLUE else Color.[no change]);
I'm unsure how to change this variable.

Edit: silly me. all i have to do is change color to black, since the up candles are hollow
 
Last edited:

BenTen

Administrative
Staff
VIP
@Playstation Here you go:

Code:
# Plot Signal
plot signal = spinningtop;
signal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
signal.SetDefaultColor(Color.CYAN);
signal.SetLineWeight(1);

The arrow isn't to give you direction, it's just telling you where the spinning top is.
 

MHCain

New member
VIP
@BenTen I saw an indicator on TView where the “body” of the Spinning Top candle is displayed a S/R line. I can probably cut and paste a code but cannot find a code that does that. I’ve only found S/R lines that display High/Low/Middle. Thanks for the guidance.
 

Similar threads

Top