Overview of Spinning Top Candlestick Pattern
The Spinning Top candlestick pattern is a significant formation in technical analysis, symbolizing a state of indecision in the market. It is characterized by its unique structure, which provides insights into market sentiment and potential future price movements. Here are the key features and implications of the Spinning Top pattern:
Appearance and Structure
- Structure: A small real body, indicating little difference between the opening and closing prices, flanked by long upper and lower shadows.
- Indication of Indecision: The pattern suggests a balance between buyers and sellers, with neither gaining control.
- Contextual Importance: Its significance varies with market trends. In an uptrend, it may signal a potential bearish reversal, and in a downtrend, a potential bullish reversal.
- Color Variations: A green or white body suggests slight bullishness, while a red or black body hints at mild bearishness.
- Use in Trading: Traders often combine the Spinning Top with other indicators to confirm trend reversals or continuations.
Importance in Technical Analysis
The Spinning Top candlestick pattern holds significant importance in technical analysis due to its ability to signal potential changes in market sentiment and direction. Here are some key aspects of its importance:
- Balance of Power: The Spinning Top’s small real body, flanked by long upper and lower shadows, indicates a tug-of-war between buyers and sellers, with neither side gaining significant ground. This balance suggests market indecision.
- Precursor to Reversals: In certain contexts, it can foreshadow a potential reversal in the existing trend, especially if it appears after a prolonged price move.
- Versatile Signal: The pattern is considered versatile as it can be identified in various market conditions – uptrends, downtrends, or sideways markets.
- Confirmatory Tool: Its significance is amplified when it appears near key support or resistance levels or in conjunction with other technical indicators.
- Combination with Other Indicators: For greater accuracy, analysts often use the Spinning Top in conjunction with other technical tools like moving averages, RSI (Relative Strength Index), or MACD (Moving Average Convergence Divergence).
Example From Trading View Chart
Defining the Spinning Top Candlestick Pattern Criteria
- Small Real Body: The real body should be small compared to the total range of the candle. This is typically defined as a percentage of the total candle range.
- Long Shadows: Both the upper and lower shadows should be significantly longer than the real body. This can also be defined as a percentage of the total candle range.
- Total Candle Range: This is the difference between the high and the low of the candle.
Code For Detecting Spinning Top
//@version=5 indicator("Spinning Top Detector", overlay=true) // Parameters for defining a 'small' body and shadow tolerance bodyThreshold = input(0.1, title="Max Body Size as % of Candle Range") shadowTolerance = input(0.1, title="Shadow Length Tolerance as % of Candle Range") // Calculate the candle components upperShadow = high - math.max(open, close) lowerShadow = math.min(open, close) - low bodySize = math.abs(close - open) candleRange = high - low // Define the central body criteria isBodySmall = bodySize <= candleRange * bodyThreshold isBodyCentered = math.abs(upperShadow - lowerShadow) <= candleRange * shadowTolerance // Define bearish and bullish Spinning Top criteria isBearishSpinningTop = isBodySmall and isBodyCentered and close < open and upperShadow > bodySize and lowerShadow > bodySize isBullishSpinningTop = isBodySmall and isBodyCentered and close > open and upperShadow > bodySize and lowerShadow > bodySize // Plotting the patterns on the chart using labels if (isBearishSpinningTop) label.new(bar_index, high, "Bearish Spinning Top", style=label.style_label_down, color=color.red, textcolor=color.white,yloc =yloc.abovebar) if (isBullishSpinningTop) label.new(bar_index, high, "Bullish Spinning Top", style=label.style_label_down, color=color.green, textcolor=color.white,yloc = yloc.abovebar)
Output
Overview of the script
1. Script Declaration
//@version=5 indicator("Spinning Top Detector", overlay=true)
//@version=5
: Specifies the version of Pine Script used, which is version 5 in this case. It’s the latest version with the most up-to-date features and syntax.indicator("Spinning Top Detector", overlay=true)
: Declares a new indicator named “Spinning Top Detector”. Theoverlay=true
parameter ensures that the indicator is drawn over the main price chart.
2. Input Parameters
bodyThreshold = input(0.1, title="Max Body Size as % of Candle Range") shadowTolerance = input(0.1, title="Shadow Length Tolerance as % of Candle Range")
bodyThreshold = input(0.1, title="Max Body Size as % of Candle Range")
: This line sets an input for the maximum size of the candle body as a percentage of the total candle range, defaulting to 10% (0.1).shadowTolerance = input(0.1, title="Shadow Length Tolerance as % of Candle Range")
: Sets an input for the tolerance in the length difference between the upper and lower shadows, also defaults to 10%.
3. Candle Component Calculations
upperShadow = high - math.max(open, close) lowerShadow = math.min(open, close) - low bodySize = math.abs(close - open) candleRange = high - low
upperShadow
,lowerShadow
,bodySize
,candleRange
: These lines calculate the key components of each candlestick – the upper shadow, lower shadow, the size of the body, and the total range of the candle.
4. Criteria for Central Body
isBearishSpinningTop = isBodySmall and isBodyCentered and close < open and upperShadow > bodySize and lowerShadow > bodySize isBullishSpinningTop = isBodySmall and isBodyCentered and close > open and upperShadow > bodySize and lowerShadow > bodySize
isBearishSpinningTop
: Checks for a bearish Spinning Top, where the candle’s closing price is lower than its opening price, along with the conditions of a small, centered body and significant shadows.isBullishSpinningTop
: Similar to the bearish condition, but checks for a bullish Spinning Top where the closing price is higher than the opening price.
5. Criteria for Spinning Tops
isBearishSpinningTop = isBodySmall and isBodyCentered and close < open and upperShadow > bodySize and lowerShadow > bodySize isBullishSpinningTop = isBodySmall and isBodyCentered and close > open and upperShadow > bodySize and lowerShadow > bodySize
isBearishSpinningTop
: Checks for a bearish Spinning Top, where the candle’s closing price is lower than its opening price, along with the conditions of a small, centered body and significant shadows.isBullishSpinningTop
: Similar to the bearish condition, but checks for a bullish Spinning Top where the closing price is higher than the opening price.
6. Label Plotting
if (isBearishSpinningTop) label.new(bar_index, high, "Bearish Spinning Top", style=label.style_label_down, color=color.red, textcolor=color.white,yloc =yloc.abovebar) if (isBullishSpinningTop) label.new(bar_index, high, "Bullish Spinning Top", style=label.style_label_down, color=color.green, textcolor=color.white,yloc = yloc.abovebar)
- The
if
statements check if either the bearish or bullish Spinning Top conditions are met for each candle. label.new(...)
: Creates new labels on the chart. For a bearish Spinning Top, the label is red and located above the bar. For a bullish Spinning Top, the label is green and also placed above the bar. Thestyle=label.style_label_down
ensures the labels point downwards for visibility.
Frequently Asked Questions
The Spinning Top is a candlestick pattern characterized by a small real body and long upper and lower shadows, indicating market indecision. This code detects the pattern by comparing the size of the candle’s real body and its shadows to predefined thresholds, marking the candle as a Spinning Top if it meets these criteria.
You can adjust the sensitivity by changing the bodyThreshold and shadowThreshold values in the script. Lowering the bodyThreshold makes the script more sensitive to smaller bodies, and increasing the shadowThreshold requires longer shadows for a candle to be classified as a Spinning Top.
bodyThreshold is the maximum proportion of the total candle range that the real body can occupy for the candle to be considered a Spinning Top. shadowThreshold is the minimum proportion of the total candle range that the shadows must occupy. Both are expressed as a percentage of the total candle range.
Labels are used to visually mark the Spinning Top patterns on the chart for easy identification. You can change their appearance by modifying parameters in the label.new function, such as color, textcolor, and style.
Conclusion
In conclusion, the “Spinning Top Detector” script is a valuable tool for traders and analysts using technical analysis. By effectively identifying and differentiating between bearish and bullish Spinning Top patterns, it provides crucial insights into market indecision points. Its customizable parameters allow users to tailor the detection criteria to their specific trading strategy and market conditions. The use of labels enhances the visibility and clarity of these patterns on the chart, making it a user-friendly and efficient tool for traders of all levels. Whether applied to short-term trading or long-term investment analysis, this script stands as a versatile and insightful addition to any trader’s toolkit, aiding in the decision-making process by highlighting potential trend reversals or continuations in various financial markets.