TradingView indicators

QQE indicator: RSI smoothing and trailing bands

The QQE indicator (Quantitative Qualitative Estimation) pairs a smoothed RSI with a trailing line built from changes in that RSI. Crosses describe momentum shifts; they can repeat in a sideways market. This guide follows Pineify's base QQE calculation with RSI length 14, smoothing 5, and a 4.236 band multiplier.

Educational example, not investment advice. The calculations below do not establish a profitable trading strategy.

From RSI to a dynamic band distance

Let n be RSI length, s be the EMA smoothing length, and [1] mean the previous bar. The base routine below applies two recursive smoothing passes to absolute changes in the fast line. Calling this an "ATR of RSI" does not make it TradingView's price-based ta.atr().

QQE calculation stages
StageCalculationInterpretation
RSIR = RSI(source, n)Default source: close; n = 14.
Fast lineF = EMA(R, s)Default s = 5. Values remain on the RSI scale.
RSI movementD = abs(F - F[1])A one-bar absolute change, not price true range.
First smoothingA = D / n + (1 - 1 / n) × A[1]The example substitutes zero for a missing prior A.
Second smoothingB = A / n + (1 - 1 / n) × B[1]The example substitutes zero for a missing prior B.
Candidate bandsW = 4.236 × B; U = F + W; L = F - WW is an RSI-point distance, not a price stop.

For n = 14, each volatility pass uses a coefficient of 1/14. An EMA of length 27 has that same coefficient, since 2/(27 + 1) = 1/14, but initialization can differ. The displayed routine uses zero for missing prior recursive values; replacing it with a differently seeded average can change early bars. Compare versions after a sufficient warm-up and with the same available history.

glaz's QQE MT4 description identifies a smoothed RSI and a Wilder-smoothed trailing line with factor 4.236. The exact recurrence on this page is the Pineify base routine printed below. The multiplier sets distance; it does not imply a measured probability or a Fibonacci price target.

The slow line keeps state between bars

The slow line T is not simply today's upper or lower band. This implementation checks the following conditions in order and uses the first match. Strict inequalities are part of the rule; equality alone does not reset a band.

Ordered QQE trailing line rules
PriorityConditionResultMeaning
1U < T[1]T = ULower the trailing line.
2F > T[1] and F[1] < T[1]T = LReset below fast after an upward crossing.
3L > T[1]T = LRaise the trailing line.
4F < T[1] and F[1] > T[1]T = UReset above fast after a downward crossing.
5None of the aboveT = T[1]Keep the previous trailing value.

A four-bar calculation you can check

Start with hypothetical prior values F = 48, T = 50, A = 0.5, B = 0.5, and n = 14. Feed the next fast-line values 52, 55, 54, and 52 into the recurrence. These are illustrative oscillator inputs, not an observed market or a backtest. Values are rounded to four decimals after calculation.

Four-bar QQE numeric example in RSI points
BarFABWTState update
1520.75000.51792.193649.8064Upward reset
2550.91070.54592.312552.6875Raise lower band
3540.91710.57242.424852.6875Hold previous value
4520.99440.60262.552554.5525Downward reset

On bar 1, D = |52 - 48| = 4, A = 4/14 + 13 × 0.5/14 = 0.75, and B = 0.75/14 + 13 × 0.5/14 = 0.517857. The upward reset places T at 52 - 4.236 × B = 49.806357. On bar 3, the new lower candidate is 51.5752, so T holds at 52.6875. Bar 4 crosses below that prior T and resets T to the upper candidate, 54.5525.

The last fast value is still above 50, yet it crosses below the slow line. A 50-level filter and a fast/slow cross answer different questions. Neither establishes the direction of the next price bar.

QQE Pine Script v6 with confirmed alerts

The function preserves Pineify's base QQE calculation. The surrounding example adds configurable source, RSI length, EMA smoothing, and bar-close alert gating. The multiplier remains fixed at 4.236. It is an indicator, so it does not place orders or produce strategy performance results.

Pine Script v6

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Pineify

//@version=6
indicator(title="Quantitative Qualitative Estimation", overlay=false, max_labels_count=500)

p_ta_qqe(series float source, simple int rsi_length, simple int rsi_smoothing_factor) =>
    rsii = ta.ema(ta.rsi(source, rsi_length), rsi_smoothing_factor)
    tr = math.abs(rsii - rsii[1])
    wwalpha = 1 / rsi_length
    wwma = 0.0
    wwma := wwalpha * tr + (1 - wwalpha) * nz(wwma[1])
    atr_rsi = 0.0
    atr_rsi := wwalpha * wwma + (1 - wwalpha) * nz(atr_rsi[1])
    qqef = ta.ema(ta.rsi(source, rsi_length), rsi_smoothing_factor)
    qup = qqef + atr_rsi * 4.236
    qdown = qqef - atr_rsi * 4.236
    qqes = 0.0
    qqes := qup < nz(qqes[1]) ? qup : qqef > nz(qqes[1]) and qqef[1] < nz(qqes[1]) ? qdown : qdown > nz(qqes[1]) ? qdown : qqef < nz(qqes[1]) and qqef[1] > nz(qqes[1]) ? qup : nz(qqes[1])
    buySignal = ta.crossover(qqef, qqes)
    sellSignal = ta.crossunder(qqef, qqes)
    [qqef, qqes, buySignal, sellSignal]

source = input.source(close, "Source")
rsiLength = input.int(14, "RSI length", minval=2)
smoothing = input.int(5, "RSI EMA smoothing", minval=1)
[p_ind_1_fast, p_ind_1_slow, p_ind_1_buySignal, p_ind_1_sellSignal] = p_ta_qqe(source, rsiLength, smoothing)

p_ind_1_fast_plot = plot(p_ind_1_fast, title="QQE - Fast Line", color=color.rgb(136, 14, 79, 0), linewidth=2)
p_ind_1_slow_plot = plot(p_ind_1_slow, title="QQE - Slow Line", color=color.rgb(33, 150, 243, 0), linewidth=2)
fill(p_ind_1_fast_plot, p_ind_1_slow_plot, title="QQE - Trend Color", color=p_ind_1_fast > p_ind_1_slow ? color.rgb(76, 175, 80, 90) : color.rgb(242, 54, 69, 90))

hline(50, "RSI midpoint", color=color.gray)

// Only the alert conditions wait for bar close; plots update intrabar.
confirmedUp = barstate.isconfirmed and p_ind_1_buySignal
confirmedDown = barstate.isconfirmed and p_ind_1_sellSignal
alertcondition(confirmedUp, title="QQE confirmed upward cross", message="QQE fast crossed above slow on a closed bar")
alertcondition(confirmedDown, title="QQE confirmed downward cross", message="QQE fast crossed below slow on a closed bar")
  1. Open Pine Editor in TradingView, paste the complete script into a new indicator, save, and add it to the chart.
  2. Set source, RSI length, and smoothing. Match symbol, timeframe, chart type, inputs, and history when comparing implementations.
  3. Create an alert using a confirmed upward or downward cross condition and choose Once Per Bar Close. Recreate it after changing the script or inputs.
Pineify base QQE output with fast and slow lines in a separate indicator pane
Existing Pineify QQE output preview. It illustrates the two-line display, not the hypothetical four-bar calculation above or a performance result.

QQE, RSI, and QQE MOD are different comparisons

RSI measures relative upward and downward price changes. QQE adds smoothing and a trailing reference to that RSI. Stochastic RSI instead locates RSI within its recent range. These transformations should not be treated as interchangeable signals.

Mihkel00's QQE MOD combines two QQEs and a Bollinger Band confirmation layer. The author has revised the script, so a name alone is insufficient to reproduce its output. Record the author, revision, smoothing passes, multiplier, and thresholds. See the separate QQE MOD guide for that variant, or the QQE / RSI combination for a combined display.

What smoothing and confirmation cannot fix

  • Repeated reversals can still cross a trailing line several times. More smoothing trades faster response for delay; it does not remove sideways losses.
  • Plots update on an open bar. Requiring a confirmed close suppresses temporary intrabar alerts but does not prevent a new opposite cross on the next closed bar.
  • A signal is not a price stop. QQE distance is measured in RSI points; a trading strategy still needs position size, price exits, costs, and an execution model.
  • Settings fitted to one period may fail in another. Evaluate separate data with commission and slippage, and record the rule for entry and exit before judging results.

Adapt a defined QQE rule with Pineify

The Pine Script AI Coding Agent can help draft or edit a script from explicit rules. Supply the code above and request the specific changes, then explicitly request a syntax check. Syntax success does not verify strategy profitability or equivalence to a different author's QQE.

Use this base QQE function unchanged. Add a configurable 50-level filter to its confirmed upward and downward crosses. Keep the raw cross alerts available separately, explain the filter, and check the final Pine v6 syntax. Do not substitute QQE MOD.

Review the generated code and compare outputs in TradingView with identical inputs. For a protected or invite-only script, work from rules you are allowed to use; a script name does not provide its hidden source.

Open Pine Script AI Coding Agent

QQE questions

Sources and implementation notes

Reviewed October 17, 2026. The code and numerical example define the exact base variant covered by this page.

Browse TradingView indicator guides