# Anti-patterns

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

Scans swing structure for the five reciprocal-ratio harmonics (anti-Gartley, anti-Bat, anti-Butterfly, anti-Crab and anti-Cypher) using a 10-bar swing length and a 5% ratio tolerance. Completed structures are drawn with XABCD point labels, measured ratios and a completion zone box, and a BC projection cross-check filters implausible completions.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jun 14, 2026.
- Access: free.
- Concepts: [Anti-patterns](https://www.luxalgo.com/library/concept/anti-patterns/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=ihjwa1wmaq1271q53sx0xu2l
- Page: https://www.luxalgo.com/library/indicator/anti-patterns/

**Anti-patterns** brings the reciprocal-ratio harmonic suite, the [anti-patterns](https://www.luxalgo.com/library/concept/anti-patterns/), to the chart as one detector for the anti-Gartley, anti-Bat, anti-Butterfly, anti-Crab and anti-Cypher. A zigzag of 10-bar swings supplies the XABCD points, and a candidate must land its B retracement, C point and D completion inside a pattern's ratio windows, within a 5% tolerance, before anything draws.

Published anti ratio tables vary between sources, so the build shows its work: labels can append the measured B retracement, D completion and BC projection so any detection can be audited against another table.

## How to Trade the Anti-patterns?

- **Bullish completion (D at a trough)**: look for an upside reaction inside the completion zone; anti-patterns resolve with the newer move rather than against it.
- **Bearish completion (D at a peak)**: the mirror read.
- **Completion Zone box**: spans the XA-based completion level (XC-based for the anti-Cypher) and the reciprocal BC projection level, extending until a reaction swing confirms.
- **Disappearing drawings**: an extending D redraws the same structure and can exit every ratio window. The removal itself is information.

## Anti-patterns Settings

- **Swing Length** (default 10): pivot half-length for the swings; larger finds larger structures, confirmed later.
- **Ratio Tolerance %** (default 5): allowed deviation around each ratio window, absorbing table differences.
- **BC Projection Cross-Check** (default on): accepts completions only with a BC projection between 1.128 and 4.236.
- **Anti-Gartley, Anti-Bat, Anti-Butterfly, Anti-Crab, Anti-Cypher** (all on by default): enable each table individually.
- Style toggles cover point labels, measured ratios, the dashed triangle lines, the completion zone and the swing zigzag.

## Frequently Asked Questions

### How do anti-patterns relate to the classic XABCD patterns?

Each anti replaces its parent's defining ratios with reciprocals: the [Cypher](https://www.luxalgo.com/library/indicator/cypher/) completes at 0.786 of XC, while the anti-Cypher looks toward the reciprocal 1.272 extension. The parents complete against a move; the antis complete with the emerging one.

### Which completion levels does this build use?

Anti-Gartley near the 1.272 extension of XA, anti-Bat near 1.128, anti-Butterfly near the 0.786 retracement, anti-Crab near 0.618, anti-Cypher near 1.272 of XC: one reciprocal-derived table among several, with Ratio Tolerance % absorbing the differences.

### Why did a drawn pattern vanish from my chart?

Until a reaction swing confirms, D is still live: if it keeps extending and leaves every ratio window, the structure no longer qualifies and its drawings are removed. Structures that resolve normally remain as history.

---

Bat®, Crab®, Shark®, AB=CD® and 5-0® are registered trademarks of their owner, used here only to identify the patterns. LuxAlgo's tools are independent implementations and are not affiliated with or endorsed by the trademark owner.

## Related indicators

- [Cypher](https://www.luxalgo.com/library/indicator/cypher/) (Elliott & Harmonics): markdown at https://www.luxalgo.com/library/indicator/cypher.md
- [Harmonic Pattern Detection](https://www.luxalgo.com/library/indicator/harmonic-pattern-detection/) (Harmonic Patterns): markdown at https://www.luxalgo.com/library/indicator/harmonic-pattern-detection.md
- [Half-Retracement Reversal Detector](https://www.luxalgo.com/library/indicator/5-0/) (5-0): markdown at https://www.luxalgo.com/library/indicator/5-0.md
- [Measured Move Detector](https://www.luxalgo.com/library/indicator/abcd/) (ABCD): markdown at https://www.luxalgo.com/library/indicator/abcd.md
- [Three Drive Pattern Detector](https://www.luxalgo.com/library/indicator/three-drive-pattern-detector/) (Three Drives): markdown at https://www.luxalgo.com/library/indicator/three-drive-pattern-detector.md
- [Potential Reversal Zone](https://www.luxalgo.com/library/indicator/potential-reversal-zone/) (Elliott & Harmonics): markdown at https://www.luxalgo.com/library/indicator/potential-reversal-zone.md
- [RSI BAMM](https://www.luxalgo.com/library/indicator/rsi-bamm/) (Elliott & Harmonics): markdown at https://www.luxalgo.com/library/indicator/rsi-bamm.md
- [Overextension Reversal Detector](https://www.luxalgo.com/library/indicator/shark/) (Shark): markdown at https://www.luxalgo.com/library/indicator/shark.md

---

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