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
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.