# Oscillator Swing Failure

Oscillator Swing Failure is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Runs a four-stage failure-swing state machine on RSI, Stochastic, CCI or MFI: an extreme pivot seeds the pattern, a lower high or higher low arms it, and a break of the fail point fires the signal. Ships with Auto thresholds per oscillator, pattern lines, a live watch level, a state dashboard and four alerts for traders who want momentum reversals confirmed by the indicator itself.

- Indicator in the LuxAlgo Library, by LuxAlgo, published May 24, 2026.
- Access: free.
- Concepts: [Oscillator Swing Failure](https://www.luxalgo.com/library/concept/oscillator-swing-failure/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=io29bppjj8t8frq51vw3rkuu
- Page: https://www.luxalgo.com/library/indicator/oscillator-swing-failure/

**Oscillator Swing Failure** brings Wilder's failure-swing template to the chart as a strict state machine, the first faithful build of the [oscillator swing failure](https://www.luxalgo.com/library/concept/oscillator-swing-failure/) in the library. A pivot inside the extreme zone seeds the pattern, the pullback between swings fixes the fail point, a lower high (or higher low from oversold) arms it, and the signal fires when the oscillator breaks that fail point. Everything happens on the indicator itself: no price pivots involved.

## How to Trade the Oscillator Swing Failure?

- **Armed**: a dotted watch line marks the fail point and the dashboard shows its value; a break of that level is the trigger, with "Armed" alerts on both sides.
- **Swing Failure label**: the fail point broke. The completed structure draws extreme, fail point and retest; its tooltip reports depth and speed.
- **Extreme Set**: the first extreme pivot printed; the build is waiting for the retest swing.

## Oscillator Swing Failure Settings

- **Oscillator** (default RSI): the line the pattern is detected on. Stochastic, CCI and MFI are the alternatives.
- **Source** (default close) and **Length** (default 14); **%K Smoothing** (default 3) applies to the Stochastic only.
- **Swing Pivot Length** (default 3): bars each side an oscillator swing must dominate; small values catch tight, fast failures.
- **Max Pattern Duration** (default 40): bar budget from extreme to break.
- **Retest Inside Threshold** (default off): keeps the retest swing out of the extreme zone.
- **Thresholds** (default Auto), or **Custom Overbought** (default 70) and **Custom Oversold** (default 30).
- **Signals** (default Both): restricts detection to one side, useful in strong trends where countertrend failures repeat; dashboard and display toggles are on by default.

## Frequently Asked Questions

### How is a swing failure different from divergence?

Divergence lines price swings up against oscillator swings, so the read depends on which price pivots you pick. A swing failure is self-referential: the [Relative Strength Index](https://www.luxalgo.com/library/indicator/relative-strength-index/) (or whichever oscillator you select) fails against its own prior extreme, then breaks its own swing point.

### Does the signal repaint?

Swings confirm Swing Pivot Length bars after their extreme, so arming arrives with that delay. Once armed, the fail-point level is locked and the break is evaluated against the live oscillator value, so on a forming bar a Swing Failure label (and its alert condition) can appear and then disappear if the oscillator moves back past the fail point before the close. Once the bar closes, a printed Swing Failure stays fixed; wait for the close if you want a confirmed signal.

### Which oscillator should I run it on?

RSI is where the template was defined, and the Auto thresholds adapt to your pick: 70/30 for RSI, 80/20 for the Stochastic and MFI, +100/-100 for CCI. Faster oscillators print more patterns with more noise; the mechanics are identical.

## Related indicators

- [Oscillator Matrix](https://www.luxalgo.com/library/indicator/luxalgo-oscillator-matrix/) (Regular Bullish/bearish Divergence): markdown at https://www.luxalgo.com/library/indicator/luxalgo-oscillator-matrix.md
- [RSI Divergence: Out-of-Sample Optimizer](https://www.luxalgo.com/library/indicator/rsi-divergence-out-of-sample-optimizer/) (Regular Bullish/bearish Divergence): markdown at https://www.luxalgo.com/library/indicator/rsi-divergence-out-of-sample-optimizer.md
- [HTF Reversal Divergences](https://www.luxalgo.com/library/indicator/htf-reversal-divergences/) (Regular Bullish/bearish Divergence): markdown at https://www.luxalgo.com/library/indicator/htf-reversal-divergences.md
- [Divergence Variants & Confirmation](https://www.luxalgo.com/library/indicator/divergence-variants-and-confirmation/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/divergence-variants-and-confirmation.md
- [Hidden Divergence](https://www.luxalgo.com/library/indicator/hidden-divergence/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/hidden-divergence.md
- [LuxAlgo - Screener (OSC)](https://www.luxalgo.com/library/indicator/luxalgo-screener-osc/) (Regular Bullish/bearish Divergence): markdown at https://www.luxalgo.com/library/indicator/luxalgo-screener-osc.md
- [RSI Candlestick Oscillator](https://www.luxalgo.com/library/indicator/rsi-candlestick-oscillator/) (Overbought/oversold): markdown at https://www.luxalgo.com/library/indicator/rsi-candlestick-oscillator.md
- [Adaptive Bounds RSI](https://www.luxalgo.com/library/indicator/adaptive-bounds-rsi/) (Overbought/oversold): markdown at https://www.luxalgo.com/library/indicator/adaptive-bounds-rsi.md

---

Source: https://www.luxalgo.com/library/indicator/oscillator-swing-failure/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
