abcdPattern
The ABCD Pattern is one of the simplest harmonic formations, built from four swing points (A, B, C, D). It helps traders identify measured moves: AB and CD legs often mirror each other in length and time. This makes it a practical tool for spotting potential reversals or continuations.
Syntax
abcdPattern(pointA, pointB, pointC, pointD, styles?)
Parameters
pointA (PricedData) · First anchor, starting the pattern.
pointB (PricedData) · Second anchor, completing the AB leg.
pointC (PricedData) · Third anchor, completing the BC leg.
pointD (PricedData) · Fourth anchor, final point and completion zone.
styles (ABCDPatternStyleOverrides) · Visual and label options:
fillBackground(boolean) · Fill the inside of the shape.transparency(number) · Background transparency (0–100).showLabels(boolean) · Display labels (A, B, C, D).line(LinesLevels without coeff) · Line style (linestyle,linewidth,color).background(RGBAColor | BaseColors) · Color for filled area.
Return Value
(string) · The drawing ID of the created ABCD Pattern.
Example
Every 60 candles, we draw an ABCD pattern connecting four recent pivots.
//@version=1
init = () => {
indicator({ onMainPanel: true, format: 'inherit' });
};
onTick = () => {
if (index % 60 === 0) { // draw every 60 bars
// 1) Choose four anchors
const A = newPoint(time(90), low(90));
const B = newPoint(time(70), high(70));
const C = newPoint(time(45), low(45));
const D = newPoint(time(20), high(20));
// 2) Define style
const style = {
fillBackground: true,
transparency: 80,
showLabels: true,
line: { linestyle: 0, linewidth: 2, color: color.blue },
background: color.rgba(0, 128, 255, 0.2)
};
// 3) Draw ABCD Pattern
abcdPattern(A, B, C, D, style);
}
};Tips
The CD leg often mirrors AB in length/time. Watch for symmetry to validate the pattern.
Works well as both a continuation (trend resumes after correction) and a reversal (market shifts direction).
Combine with Fibonacci: AB retrace to C often lands at 0.618, and CD often extends 1.272 or 1.618.
Warning
Don’t force uneven swings into an ABCD — if legs are wildly out of proportion, it isn’t valid.
Good Practice
Keep a consistent
const styleso your harmonic patterns are visually distinct but not cluttered.Use the ABCD as a base structure: many advanced harmonic patterns (like Gartley or Bat) are built from an ABCD inside.
Last updated