TradingView indicator guides

QQE MOD: Exact Parameters, Bands and Signal States

This QQE MOD example combines two trailing-band calculations with a Bollinger envelope on the primary trailing line. Cyan and pink columns show conditions that remain true on a bar; they do not require two simultaneous crosses. With the supplied defaults, both smoothed RSI streams are identical.

Inspect the Pine Script

Identify the author and implementation version

Mihkel00's QQE MOD publication dates to January 2020 and credits glaz's QQE. Its December 2024 revision provides a Pine v6 implementation. The code here follows that revision's single smoothing pass on absolute RSI changes, with fixed arguments and a simpler display. It is not every historical QQE MOD version.

The author's v6 source conditionally displays the neutral secondary histogram and includes primary-RSI zero-cross alert conditions. This example always plots the neutral secondary histogram and includes no alerts. Match source and revision before comparing outputs rather than relying on the same indicator name.

Trace the dependencies before changing parameters

F = EMA(RSI(source, n), smoothing) D = abs(F − F[1]) A = EMA(D, 2 × n − 1) Distance = A × factor Long candidate = F − Distance Short candidate = F + Distance

The recursive long and short bands retain or reset their values according to the comparisons in the code. Trend selection uses ta.cross, which detects either direction, against shifted band series; it is not a simple above/below test. The short-band cross branch has priority when both cross conditions occur. The selected trailing line can therefore depend on prior band and trend state.

Both calls use source close, RSI length 6 and EMA smoothing 5. Their smoothed RSI values are consequently equal on matching history. Factors 3 and 1.61 alter the trailing distances, not those RSI streams. These are two related calculations, not statistically independent confirmations. The distance is measured in RSI points, not price ATR.

Which arguments can affect colored columns?

ArgumentActual role in this example
Primary length 6, smoothing 5, source closeSet primary RSI and its trailing line, so they affect the Bollinger comparison.
Primary factor 3Changes primary trailing bands and the series used by Bollinger calculations.
Primary threshold 3Unused function argument. Changing it alone changes no returned output.
Secondary length 6, smoothing 5, source closeSet the secondary RSI histogram and its threshold test.
Secondary factor 1.61Changes the secondary trailing line only; that line is not used in the colored-column conditions.
Secondary threshold 3Requires centered secondary RSI strictly above 3 or below −3.
Bollinger length 50, multiplier 0.35Set the mean and width of the primary trailing-line envelope.

The function has twelve arguments, but the complete script declares no user inputs. Change the function call to alter a calculation; the indicator Settings panel does not provide these length and factor inputs. An unused threshold is retained for compatibility here, not presented as a working filter.

Band construction and strict state tests

X = primary trailing line − 50 Basis = SMA(X, 50) Upper = Basis + 0.35 × population stdev(X, 50) Lower = Basis − 0.35 × population stdev(X, 50) Up = secondary RSI − 50 > 3 AND primary RSI − 50 > Upper Down = secondary RSI − 50 < −3 AND primary RSI − 50 < Lower

The envelope is built from the primary trailing line, but its comparison uses primary smoothed RSI. These are different series. Centering by 50 changes neither standard deviation nor band width. Width equals twice multiplier times standard deviation; increasing 0.35 to 0.45 increases width by 0.2 times standard deviation, or about 28.57% for unchanged underlying data. It does not imply any fixed percentage change in event counts.

A synthetic five-value envelope calculation uses centered trailing values 0, 1, 2, 3, 4, giving mean 2 and population standard deviation √2. At multiplier 0.35, upper is 2.494975 and lower is 1.505025. This shortened window illustrates arithmetic; the supplied script uses 50.

Holding those assumed bands fixed, equal centered primary and secondary RSI of 4 satisfy Up. A value of exactly 3 fails the strict secondary threshold; 2.4 also fails the upper-band test. A value of −4 satisfies Down. These are isolated condition checks, not a reconstructed price history. If Up stays true across four bars, four cyan columns can appear; the script does not emit only the first transition.

Display, initialization and unfinished bars

The white line is the secondary trailing line minus 50. Pine's color transparency of 0 makes it opaque, not hidden; it can be hard to see on a white background. Raising transparency to 90 makes it less visible. Gray columns plot centered secondary RSI even when neither colored condition holds. Cyan and pink columns overlay qualifying values; absence of a highlight does not establish a reversal or a market-regime classification.

RSI, EMA, trailing state and the Bollinger window each need history. Missing early values can suppress signals; zero is not an automatic replacement for missing oscillator data. In this implementation, an unknown initial trend falls through to the short-band selection until a trend value is established. Compare loaded history and intermediate series when checking another implementation.

Plots are live on the current bar. There is no confirmed-bar gate, alert condition, higher-timeframe request, volume filter or strategy order in this copy. A later bar can reverse a completed highlight. Neither the name nor the two-call structure establishes fewer false signals, a fixed two-bar delay or a profitable market/timeframe combination.

Pine Script v6: implementation and limits

The two complete helper functions and fixed argument call are included. The original calculation is retained so the unused argument and display dependencies can be inspected directly. No external library is required.

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="QQE MOD", overlay=false, max_labels_count=500)

//#region Ta Dependence

p_ta_calculateQQE(simple int rsiLength, simple int smoothingFactor, simple float qqeFactor, series float source) =>
    wildersLength = rsiLength * 2 - 1
    rsi = ta.rsi(source, rsiLength)
    smoothedRsi = ta.ema(rsi, smoothingFactor)
    atrRsi = math.abs(smoothedRsi[1] - smoothedRsi)
    smoothedAtrRsi = ta.ema(atrRsi, wildersLength)
    dynamicAtrRsi = smoothedAtrRsi * qqeFactor

    longBand = 0.0
    shortBand = 0.0
    trendDirection = 0

    atrDelta = dynamicAtrRsi
    newShortBand = smoothedRsi + atrDelta
    newLongBand = smoothedRsi - atrDelta
    longBand := smoothedRsi[1] > longBand[1] and smoothedRsi > longBand[1] ? math.max(longBand[1], newLongBand) : newLongBand
    shortBand := smoothedRsi[1] < shortBand[1] and smoothedRsi < shortBand[1] ? math.min(shortBand[1], newShortBand) : newShortBand
    longBandCross = ta.cross(longBand[1], smoothedRsi)

    if ta.cross(smoothedRsi, shortBand[1])
        trendDirection := 1
    else if longBandCross
        trendDirection := -1
    else
        trendDirection := trendDirection[1]

    qqeTrendLine = trendDirection == 1 ? longBand : shortBand
    [qqeTrendLine, smoothedRsi]

p_ta_qqe_mod(simple int rsiLengthPrimary, simple int rsiSmoothingPrimary, simple float qqeFactorPrimary, simple float thresholdPrimary, series float sourcePrimary, simple int rsiLengthSecondary, simple int rsiSmoothingSecondary, simple float qqeFactorSecondary, simple float thresholdSecondary, series float sourceSecondary, simple int bollingerLength, simple float bollingerMultiplier) =>

    [primaryQQETrendLine, primaryRSI] = p_ta_calculateQQE(rsiLengthPrimary, rsiSmoothingPrimary, qqeFactorPrimary, sourcePrimary)

    [secondaryQQETrendLine, secondaryRSI] = p_ta_calculateQQE(rsiLengthSecondary, rsiSmoothingSecondary, qqeFactorSecondary, sourceSecondary)

    bollingerBasis = ta.sma(primaryQQETrendLine - 50, bollingerLength)
    bollingerDeviation = bollingerMultiplier * ta.stdev(primaryQQETrendLine - 50, bollingerLength)
    bollingerUpper = bollingerBasis + bollingerDeviation
    bollingerLower = bollingerBasis - bollingerDeviation

    qqeUpSignal = secondaryRSI - 50 > thresholdSecondary and primaryRSI - 50 > bollingerUpper
    qqeDownSignal = secondaryRSI - 50 < -thresholdSecondary and primaryRSI - 50 < bollingerLower

    [primaryQQETrendLine, primaryRSI, secondaryQQETrendLine, secondaryRSI, bollingerUpper, bollingerLower, qqeUpSignal, qqeDownSignal]

//#endregion

// Inputs
[p_ind_1_primaryQQETrendLine, p_ind_1_primaryRSI, p_ind_1_secondaryQQETrendLine, p_ind_1_secondaryRSI, p_ind_1_bollingerUpper, p_ind_1_bollingerLower, p_ind_1_qqeUpSignal, p_ind_1_qqeDownSignal] = p_ta_qqe_mod(6, 5, 3, 3, close, 6, 5, 1.61, 3, close, 50, 0.35)

// Plots
plot(p_ind_1_secondaryQQETrendLine - 50, title="QQE MOD - Secondary QQE Trend Line", color=color.rgb(255, 255, 255, 0), linewidth=2)
plot(p_ind_1_secondaryRSI - 50, color=color.rgb(112, 112, 112, 80), title="QQE MOD - Secondary RSI Histogram", style=plot.style_columns)
plot(p_ind_1_qqeUpSignal ? p_ind_1_secondaryRSI - 50 : na, title="QQE MOD - QQE Up Signal", style=plot.style_columns, color=color.rgb(0, 195, 255, 0))
plot(p_ind_1_qqeDownSignal ? p_ind_1_secondaryRSI - 50 : na, title="QQE MOD - QQE Down Signal", style=plot.style_columns, color=color.rgb(255, 0, 98, 0))
hline(0, title="QQE MOD - Zero Line", color=color.rgb(255, 255, 255, 0), linestyle=hline.style_dotted)
Existing indicator chart preview
Existing visual preview. Verify exact values against the source; the image is not a performance result.

Specify a checkable adaptation in Pineify

Provide the exact version and code, then request the desired inputs or a first-state-transition alert with explicit bar-close timing. Ask the Pine Script AI Coding Agent to preserve the calculation and expose intermediate RSI, bands and conditions for checking. A strategy needs separate entries, exits, costs and validation; no performance result is supplied here.

Open Pine Script AI Coding Agent

Educational indicator analysis. No measured trading performance is established here. Syntax validation does not prove formula equivalence, execution assumptions or profitability.

Implementation questions

No. Both use close, RSI length 6 and EMA smoothing 5, so the smoothed RSI readings are identical. The two factors change trailing bands rather than the RSI calculation.

thresholdPrimary is accepted by the function but never read in its calculations. It is not an active filter in this implementation.

Not by itself in this code. It changes the secondary trailing line, while highlight conditions use secondary RSI and the primary Bollinger comparison. Those conditions do not read the secondary line.

No. The conditions test levels using strict greater-than and less-than comparisons on each bar. A condition can remain true for multiple consecutive columns.

Its RGB color is white with zero transparency, which is fully opaque. Use a contrasting color on a light chart; increasing transparency makes it less visible.

No. The calculation follows the published December 2024 v6 single-volatility-smoothing version, with fixed arguments and display/alert differences described on this page. Earlier revisions or other authors may calculate different series.