What is Qstick?
Qstick is a technical indicator that measures the market's internal momentum by quantifying the strength and direction of candlestick bodies over a specified period. Developed by Tushar Chande and Stanley Kroll, Qstick essentially calculates the Simple Moving Average (SMA) of the difference between the closing price and the opening price of each candlestick. A positive Qstick value indicates that candlesticks are closing higher than they open on average, suggesting bullish momentum. Conversely, a negative value indicates bearish momentum.
In Pine Script, Qstick is a valuable tool for traders seeking a smoothed view of real body momentum, helping to identify trend changes, confirm direction, and spot divergences without the noise often found in pure price oscillators.
Components and Calculation
The calculation of Qstick is straightforward:
- Individual Bar Difference (C-O): For each bar, calculate `Close - Open`. This represents the "body" of the candlestick. A positive value means a bullish candle; a negative value means a bearish candle.
- Qstick Formula: Calculate the Simple Moving Average (SMA) of these `(Close - Open)` differences over a specified `length` (e.g., 10 periods).
`Qstick = SMA( (Close - Open), length)`
The resulting Qstick value oscillates around a zero line. Values above zero suggest increasing bullish momentum from candlestick bodies, while values below zero suggest increasing bearish momentum.
Basic Qstick Implementation in Pine Script
Pine Script v5 provides a convenient built-in function `ta.qstick()` for calculating Qstick.
//@version=5
indicator("My Qstick Indicator", overlay=false) // overlay=false to plot in a separate pane
// Input for Qstick length
length = input.int(10, title="Qstick Length", minval=1)
// Calculate Qstick value using the built-in function
qstickValue = ta.qstick(length)
// Plot the Qstick line
plot(qstickValue, title="Qstick", color=color.blue, linewidth=2)
// Plot the Zero Line
hline(0, "Zero Line", color.gray, linestyle=hline.style_solid)
// Optional: Add bands for visual reference, although Qstick is unbounded
// (These bands are illustrative and depend on historical observation for the asset)
// hline(avg(abs(qstickValue), 50), "Upper Ref", color=color.red, linestyle=hline.style_dashed)
// hline(-avg(abs(qstickValue), 50), "Lower Ref", color=color.green, linestyle=hline.style_dashed)
Practical Qstick Trading Strategies
1. Zero Line Crossover (Momentum Shift)
The most common and straightforward strategy with Qstick involves its crossovers of the zero line. This signals a shift in the dominant candlestick body momentum.
- Buy Signal: Qstick crosses above the zero line. This indicates that bullish candlestick bodies are starting to dominate, suggesting a potential shift to an uptrend or continuation of an existing one.
- Sell Signal: Qstick crosses below the zero line. This indicates that bearish candlestick bodies are starting to dominate, suggesting a potential shift to a downtrend or continuation.
//@version=5
strategy("Qstick Zero Line Crossover Strategy", overlay=true)
// Input for Qstick length
length = input.int(10, title="Qstick Length", minval=1)
zeroLine = 0.0
// Calculate Qstick
qstickValue = ta.qstick(length)
// Plot Qstick in a separate pane for visualization
plot(qstickValue, "Qstick", color.blue, display=display.pane_only)
hline(zeroLine, "Zero Line", color.gray, linestyle=hline.style_solid, display=display.pane_only)
// Define conditions for entries
longSignal = ta.crossover(qstickValue, zeroLine)
shortSignal = ta.crossunder(qstickValue, zeroLine)
// Strategy entries/exits
if (longSignal)
strategy.entry("Long", strategy.long)
if (shortSignal)
strategy.entry("Short", strategy.short)
2. Trend Confirmation and Strength
The magnitude of Qstick can confirm the strength of a trend. Consistently positive and rising Qstick values confirm a strong uptrend, while consistently negative and falling values confirm a strong downtrend.
- Strong Bullish Trend: Qstick is consistently positive and making higher highs, indicating strong bullish conviction in the candlestick bodies.
- Strong Bearish Trend: Qstick is consistently negative and making lower lows, indicating strong bearish conviction in the candlestick bodies.
//@version=5
strategy("Qstick Trend Strength Confirmation", overlay=true)
length = input.int(10, title="Qstick Length", minval=1)
qstickValue = ta.qstick(length)
plot(qstickValue, "Qstick", color.blue, display=display.pane_only)
hline(0, "Zero Line", color.gray, linestyle=hline.style_solid, display=display.pane_only)
// Using a simple threshold for strength, adjust based on asset
bullishStrengthThreshold = input.float(0.5, title="Bullish Strength Threshold", step=0.1)
bearishStrengthThreshold = input.float(-0.5, title="Bearish Strength Threshold", step=0.1)
// Long entry: Qstick is positive and above a certain strength threshold
longConfirm = qstickValue > bullishStrengthThreshold and qstickValue > qstickValue[1]
// Short entry: Qstick is negative and below a certain strength threshold
shortConfirm = qstickValue < bearishStrengthThreshold and qstickValue < qstickValue[1]
if (longConfirm)
strategy.entry("TrendLong", strategy.long)
if (shortConfirm)
strategy.entry("TrendShort", strategy.short)
// Example exit: if Qstick crosses zero or reverses strongly
strategy.close("TrendLong", when=qstickValue < 0)
strategy.close("TrendShort", when=qstickValue > 0)
3. Qstick Divergence Strategy
Divergence between price and Qstick can be a powerful early warning signal for trend reversals, as it suggests that the underlying momentum from candlestick bodies is weakening even if price continues its current path.
- Bullish Divergence: Price makes a lower low, but Qstick makes a higher low. This indicates weakening bearish momentum from candlestick bodies, suggesting a potential upward reversal.
- Bearish Divergence: Price makes a higher high, but Qstick makes a lower high. This indicates weakening bullish momentum from candlestick bodies, suggesting a potential downward reversal.
//@version=5
indicator("Qstick Divergence Scanner", overlay=true)
length = input.int(10, title="Qstick Length", minval=1)
qstickValue = ta.qstick(length)
plot(qstickValue, "Qstick", color.blue)
hline(0, "Zero Line", color.gray, linestyle=hline.style_solid)
// Simple divergence detection (conceptual, robust detection requires advanced pivot logic)
// This is a simplified example focusing on price vs Qstick divergence.
// Bullish Divergence (Price lower low, Qstick higher low)
bullishDivergence = close[2] > close[1] and close[1] > close and qstickValue[2] < qstickValue[1] and qstickValue[1] < qstickValue
// Bearish Divergence (Price higher high, Qstick lower high)
bearishDivergence = close[2] < close[1] and close[1] < close and qstickValue[2] > qstickValue[1] and qstickValue[1] > qstickValue
plotshape(bullishDivergence, title="Bullish Divergence", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(bearishDivergence, title="Bearish Divergence", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
alertcondition(bullishDivergence, "Bullish Qstick Divergence", "Potential bullish reversal based on Qstick divergence.")
alertcondition(bearishDivergence, "Bearish Qstick Divergence", "Potential bearish reversal based on Qstick divergence.")
Optimizing Qstick Performance
To get the most from Qstick in Pine Script:
- Parameter Tuning: The `length` parameter is crucial. A shorter length (e.g., 5 periods) will make Qstick more sensitive and reactive to immediate candlestick momentum, while a longer length (e.g., 20 periods) will provide a smoother, less noisy signal for longer-term trends. Experiment to find the optimal setting for your trading style and the asset's typical behavior.
- Combine with Trend Filters: While Qstick indicates momentum, it can be prone to false signals in choppy or non-trending markets. Always use it in conjunction with a separate trend-following indicator (e.g., a longer-period EMA or ADX) on the price chart to confirm the broader trend direction. Use Qstick for timing entries/exits within that confirmed trend.
- Confluence with Price Action: Always look for Qstick signals to be confirmed by actual price action. For instance, a bullish Qstick zero-line crossover is stronger if the price is also breaking above a short-term resistance or forming a bullish candlestick pattern.
- Divergence Reliability: Pay special attention to divergence signals. Because Qstick focuses on the real body, divergence can be a powerful indicator of waning conviction behind a price move.
- Volume Analysis: Strong Qstick readings (high positive or low negative) are often accompanied by significant volume, which can add further conviction to the momentum signal.
Common Qstick Pitfalls
- Whipsaws in Sideways Markets: In choppy or range-bound markets, Qstick can frequently cross the zero line, leading to numerous false signals. It performs best when there is clear directional momentum.
- Lag: As Qstick uses a Simple Moving Average, it has some inherent lag and will not perfectly pinpoint exact tops or bottoms.
- Unbounded Nature: Unlike some oscillators, Qstick has no fixed upper or lower limits. This means interpreting "overbought" or "oversold" requires historical observation of an asset's typical extreme Qstick values, rather than relying on universal thresholds like 70/30 for RSI.
- Requires Clear Candlestick Bodies: On assets with very small or inconsistent candlestick bodies, Qstick might not provide clear signals.
- Not a Standalone Indicator: Qstick should always be used as part of a broader trading system, complementing other indicators and price action analysis for comprehensive decision-making and risk management.
Conclusion
Qstick is an insightful technical indicator in Pine Script for TradingView that offers a unique perspective on market momentum by quantifying the strength of candlestick bodies. By smoothing the difference between open and close prices, it helps traders identify shifts in underlying buying and selling pressure. Whether used for identifying trend changes through zero-line crossovers, confirming trend strength, or spotting powerful reversals through divergence, Qstick provides valuable insights into market dynamics. By understanding its calculation, thoughtfully tuning its parameters, and integrating it strategically with other technical analysis tools, you can leverage Qstick to enhance your trading decisions and gain a clearer understanding of market conviction.
Enhance Your Trading
Get a high-performance Pine Script analysis tool for actionable market insights, designed for traders on the move.
This strategy runs in live mode on TradingView, helping you identify potential opportunities.
Subscribe now @ $99/month