cypherPattern
The Cypher Pattern is another harmonic pattern that uses five swing points (X, A, B, C, D). It’s less common than Gartley or Bat, but many traders like it for its reliability when the market makes deeper “fakeout” moves before completing. It helps anticipate potential reversal zones with specific Fibonacci ratios.
Syntax
cypherPattern(pointX, pointA, pointB, pointC, pointD, styles?)
Parameters
pointX (PricedData) · First anchor, starting point of the pattern.
pointA (PricedData) · Second anchor, completing the XA leg.
pointB (PricedData) · Third anchor, completing the AB leg.
pointC (PricedData) · Fourth anchor, creating a deep move against AB.
pointD (PricedData) · Fifth anchor, the completion and potential reversal zone.
styles (CypherPatternStyleOverrides) · Style and display options:
fillBackground(boolean) · Fill the inside of the Cypher with color.transparency(number) · Background transparency (0–100).showLabels(boolean) · Show leg labels (XA, AB, BC, CD).line(LinesLevels without coeff) · Line style (linestyle,linewidth,color).background(RGBAColor | BaseColors) · Fill color of the pattern.
Return Value
(string) · The drawing ID of the created Cypher Pattern.
Example
Here we draw a Cypher every 100 candles, connecting five pivots from the past.
//@version=1
init = () => {
indicator({ onMainPanel: true, format: 'inherit' });
};
onTick = () => {
if (index % 100 === 0) { // draw every 100 bars
// 1) Pick swing points
const X = newPoint(time(120), low(120));
const A = newPoint(time(95), high(95));
const B = newPoint(time(75), low(75));
const C = newPoint(time(50), high(50)); // deep retrace leg
const D = newPoint(time(25), low(25)); // completion zone
// 2) Style options
const style = {
fillBackground: true,
transparency: 80,
showLabels: true,
line: { linestyle: 0, linewidth: 2, color: color.green },
background: color.rgba(0, 255, 128, 0.2)
};
// 3) Draw Cypher
cypherPattern(X, A, B, C, D, style);
}
};Tips
The Cypher’s key feature is point C going beyond XA (a deeper extension), while D pulls back into a Fibonacci zone (often 0.786 of XC).
Best used on trend reversals after strong moves.
Confirm at point D with extra signals (oscillator divergence, volume, or support/resistance).
Warning
Don’t confuse Cypher with the Gartley or Bat — the main difference is C leg extends further than XA. Misplacing this point invalidates the pattern.
Good Practice
Stick to the known ratios (C usually extends 1.272–1.414 of XA, and D pulls back to 0.786 of XC).
Keep a simple color scheme across your harmonic patterns (e.g., blue for Gartley, green for Cypher, red for Bat) to visually separate them on your chart.
Last updated