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:

  • bold (boolean): render text using a bold font weight.

  • color (RGBAColor | BaseColors): line color of the pattern.

  • fontsize (number): font size used for text labels.

  • italic (boolean): render text using italic style.

  • linewidth (number): thickness of the pattern lines.

  • textcolor (RGBAColor | BaseColors): color of the label text.

Return Value

(string) Β· The drawing ID of the created ABCD Pattern.

Example

Every 100 candles, we draw an ABCD pattern connecting four recent pivots.

//@version=1
init = () => {
  indicator({ onMainPanel: true, format: 'inherit' });
};

onTick = () => {
  if (index % 100 === 0) { // draw every 100 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 = {
      color: color.lightblue,
      linewidth: 3, 
      textcolor: color.blue
    };

    // 3) Draw ABCD Pattern
    abcdPattern(A, B, C, D, style);
  }
};

Result

circle-info

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.

triangle-exclamation

Warning

circle-check

Good Practice

Last updated