# Cypher

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

Cypher detects bullish and bearish XABCD Cypher patterns from confirmed swings, validating the B retracement (0.382–0.618 of XA) and C extension (1.272–1.414) before projecting the D completion at the 0.786 retracement of the full XC swing. Completed patterns carry staged CD targets, an X stop line, and fourteen alerts spanning setup to final target.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jul 23, 2026.
- Access: free.
- Concepts: [Cypher](https://www.luxalgo.com/library/concept/cypher/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=s0pbd2t4l2rq0on6p201lq6u
- Page: https://www.luxalgo.com/library/indicator/cypher/

**Cypher** is the first faithful implementation of the [Cypher pattern](https://www.luxalgo.com/library/concept/cypher/) in the Library, honoring the rule most versions get wrong: D is measured from the full XC swing, not from XA. A zigzag of confirmed swings supplies the X, A, B, and C points; when the B retracement and C extension both qualify, the legs are drawn with their measured ratios printed for audit, and the projected D level extends forward at the 0.786 retracement of XC with a dashed stop at X.

## How to Trade the Cypher?

- **Completion touch**: price trades into the D level. Wait for a response back toward C rather than entering blind.
- **Reaction close**: a close back beyond D in the C direction is the build's confirmation that the level held.
- **Staged targets**: dotted lines at the 0.382 and 0.618 retracements of the CD leg, with the C extreme as the final objective.
- **X stop**: a decisive close beyond the X origin fades the drawings and ends the trade frame.

Projections that never complete are removed automatically once price runs beyond the C extreme without touching the level.

## Cypher Settings

- **Swing Length** (default 8): pivot length for the swing points; larger values find larger, rarer structures.
- **B / XA Retracement** (defaults 0.382–0.618): accepted B range, the bounds rule sets disagree on most.
- **C / XA Extension** (defaults 1.272–1.414): required push of C beyond the A extreme, measured from X.
- **D / XC Retracement** (default 0.786): the completion level's defining ratio.
- **Target 1 (CD Retracement)** (default 0.382) and **Target 2 (CD Retracement)** (default 0.618): the staged profit levels.
- Display toggles: **Point Labels**, **Ratio Labels**, **Target Lines**, **X Stop Line**, and **Show Swings** (all default on), plus pattern colors.

## Frequently Asked Questions

### How is the Cypher different from the Shark?

Both structures push past a prior extreme mid-pattern, breaking the Gartley mold. The Shark® works from its own ratio set and completion zone, while the Cypher requires C at 1.272–1.414 of XA and D at 0.786 of the whole XC swing. If the extension falls outside that range, check the [Overextension Reversal Detector](https://www.luxalgo.com/library/indicator/shark/) first.

### Why do alerts sometimes fire the moment a pattern appears?

Swing confirmation lags by the Swing Length, so a completion, target hit, or even an invalidation can occur inside that lag. The build back-scans those bars when the pattern registers and fires the corresponding alerts immediately.

### Is the Cypher a reversal or continuation pattern?

It leans toward resumption: C prints the new extreme, D retraces the whole advance, and the target ladder climbs back toward C. The X stop marks where that read stops being valid.

---

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

- [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
- [Anti-patterns](https://www.luxalgo.com/library/indicator/anti-patterns/) (Elliott & Harmonics): markdown at https://www.luxalgo.com/library/indicator/anti-patterns.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/cypher/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
