Master this unique momentum indicator in TradingView's Pinescript that quantifies the strength of candlestick bodies to reveal underlying buying and selling pressure.
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 Pinescript, 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.
The calculation of Qstick is straightforward:
//@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)
Qstick filters out the noise from wicks and focuses solely on the strength of the candle's real body, providing a smoother momentum signal.
//@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)
//@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)
//@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.")
To get the most from Qstick in Pinescript:
Qstick offers a unique perspective by averaging the strength of bullish and bearish candlestick bodies, providing a clearer signal of who's in control on a bar-by-bar basis.
Qstick is an insightful technical indicator in Pinescript 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.
Get a high-performance Pinescript 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.
Get Pinescript Strategy