OPEN-SOURCE SCRIPT
Selectable Time Stoch Quad Oscillator

Just like my other Stochastic oscillator, with the addition of selectable timeframe!
Stoch Quad Oscillator — User Guide
🧠 Overview
The Stoch Quad Oscillator is a multi-timeframe momentum indicator that tracks four independent stochastic %D lines, each with different smoothing and period settings. It helps detect strong bullish or bearish rotational conditions and overbought/oversold extremes across timeframes.
This version includes:
Configurable timeframe (default: 1-minute) using security()
Slope-based rotation detection across four stochastic levels
Background highlights for strong bullish/bearish momentum setups
⚙️ Inputs & Parameters
🕒 Timeframe
Timeframe for Stochastic Calculation
Type: timeframe
Default: "1" (1-minute)
Sets the timeframe on which all stochastic calculations are performed using request.security().
📈 Stochastic Levels
Each stochastic level has its own %K period and %D smoothing:
Level %K Length %D Smoothing Default Label
1 9 3 %D K9 D3
2 14 3 %D K14 D3
3 40 4 %D K40 D4
4 60 10 %D K60 D10
Smoothing Type: Choose between SMA and EMA for the %D line (default: EMA).
📊 Overbought / Oversold Levels
Overbought Level: Default = 80
Oversold Level: Default = 20
Used to highlight all four stochastics being in extreme zones.
🔁 Quad Rotation Detection
Detects high-momentum reversals across all four stochastic levels using slope and aggregate thresholds.
Setting Description
Enable Quad Rotation Enables detection of bullish/bearish multi-level slope convergence
Slope Calculation Bars How many bars back to compare the slope
Slope Threshold Slope required to trigger a sharp rotation
Oversold Quad Level Total %D value across all 4 levels to consider as oversold (default: 90)
Overbought Quad Level Total %D value to consider as overbought (default: 310)
Slope Averaging Method "Simple" or "Weighted" slope averaging across levels
Max Signal Bar Window Future-proof field (not actively used in this version)
🎨 Visualization Colors
Bullish Rotation Highlight: Background color when bullish quad rotation is detected
Bearish Rotation Highlight: Background color when bearish quad rotation is detected
Also includes faint background when all four %D values are simultaneously:
Above the overbought level (deep red)
Below the oversold level (deep green)
📉 Chart Display
✅ Lines Plotted
Four %D lines representing different stochastic timeframes and lengths
Overbought (80) and Oversold (20) horizontal reference lines
🎯 Background Highlights
Light Green: Bullish rotation across all 4 stochastics from oversold zone with strong slope up
Light Red: Bearish rotation across all 4 stochastics from overbought zone with strong slope down
Faint Red/Green: All four stochastics are above or below extreme levels
📌 How to Use
Bullish Setup
All four %D lines are oversold (sum < oversoldQuadLevel)
Average slope across levels is rising above slopeThreshold
Background turns light green — signals potential reversal up
Bearish Setup
All four %D lines are overbought (sum > overboughtQuadLevel)
Average slope across levels is falling below -slopeThreshold
Background turns light red — signals potential reversal down
🚧 Limitations
Uses only %D lines (smoothed K) — raw %K values are not plotted
Assumes valid %D range is [0, 100], clamps values accordingly
Not predictive — signals may lag if settings are too long or slope is too smooth
May repaint when using higher timeframes due to request.security() behavior
🧪 Tips for Power Users
Set timeframe to "5" or "15" to align fast signals with higher-timeframe context
Combine with price action tools (support/resistance, trendlines, candles) for confirmation
Use "Weighted" slope averaging to emphasize longer-period stochastic moves
Stoch Quad Oscillator — User Guide
🧠 Overview
The Stoch Quad Oscillator is a multi-timeframe momentum indicator that tracks four independent stochastic %D lines, each with different smoothing and period settings. It helps detect strong bullish or bearish rotational conditions and overbought/oversold extremes across timeframes.
This version includes:
Configurable timeframe (default: 1-minute) using security()
Slope-based rotation detection across four stochastic levels
Background highlights for strong bullish/bearish momentum setups
⚙️ Inputs & Parameters
🕒 Timeframe
Timeframe for Stochastic Calculation
Type: timeframe
Default: "1" (1-minute)
Sets the timeframe on which all stochastic calculations are performed using request.security().
📈 Stochastic Levels
Each stochastic level has its own %K period and %D smoothing:
Level %K Length %D Smoothing Default Label
1 9 3 %D K9 D3
2 14 3 %D K14 D3
3 40 4 %D K40 D4
4 60 10 %D K60 D10
Smoothing Type: Choose between SMA and EMA for the %D line (default: EMA).
📊 Overbought / Oversold Levels
Overbought Level: Default = 80
Oversold Level: Default = 20
Used to highlight all four stochastics being in extreme zones.
🔁 Quad Rotation Detection
Detects high-momentum reversals across all four stochastic levels using slope and aggregate thresholds.
Setting Description
Enable Quad Rotation Enables detection of bullish/bearish multi-level slope convergence
Slope Calculation Bars How many bars back to compare the slope
Slope Threshold Slope required to trigger a sharp rotation
Oversold Quad Level Total %D value across all 4 levels to consider as oversold (default: 90)
Overbought Quad Level Total %D value to consider as overbought (default: 310)
Slope Averaging Method "Simple" or "Weighted" slope averaging across levels
Max Signal Bar Window Future-proof field (not actively used in this version)
🎨 Visualization Colors
Bullish Rotation Highlight: Background color when bullish quad rotation is detected
Bearish Rotation Highlight: Background color when bearish quad rotation is detected
Also includes faint background when all four %D values are simultaneously:
Above the overbought level (deep red)
Below the oversold level (deep green)
📉 Chart Display
✅ Lines Plotted
Four %D lines representing different stochastic timeframes and lengths
Overbought (80) and Oversold (20) horizontal reference lines
🎯 Background Highlights
Light Green: Bullish rotation across all 4 stochastics from oversold zone with strong slope up
Light Red: Bearish rotation across all 4 stochastics from overbought zone with strong slope down
Faint Red/Green: All four stochastics are above or below extreme levels
📌 How to Use
Bullish Setup
All four %D lines are oversold (sum < oversoldQuadLevel)
Average slope across levels is rising above slopeThreshold
Background turns light green — signals potential reversal up
Bearish Setup
All four %D lines are overbought (sum > overboughtQuadLevel)
Average slope across levels is falling below -slopeThreshold
Background turns light red — signals potential reversal down
🚧 Limitations
Uses only %D lines (smoothed K) — raw %K values are not plotted
Assumes valid %D range is [0, 100], clamps values accordingly
Not predictive — signals may lag if settings are too long or slope is too smooth
May repaint when using higher timeframes due to request.security() behavior
🧪 Tips for Power Users
Set timeframe to "5" or "15" to align fast signals with higher-timeframe context
Combine with price action tools (support/resistance, trendlines, candles) for confirmation
Use "Weighted" slope averaging to emphasize longer-period stochastic moves
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.