trianglePattern
The Triangle Pattern connects four swing points (A, B, C, D) to form a contracting or expanding triangle. Traders use it to anticipate breakouts because price tends to coil inside the triangle before moving strongly in one direction. It can appear as ascending, descending, or symmetrical.
Syntax
trianglePattern(pointA, pointB, pointC, pointD, styles?)
Parameters
pointA (PricedData) · First anchor, starting the triangle.
pointB (PricedData) · Second anchor, forming the opposite side.
pointC (PricedData) · Third anchor, continuing the structure.
pointD (PricedData) · Fourth anchor, completing the triangle.
styles (TrianglePatternStyleOverrides) · Style and visual options:
fillBackground(boolean) · Fill the inside of the triangle.transparency(number) · Background transparency (0–100).showLabels(boolean) · Show point labels (A, B, C, D).line(LinesLevels without coeff) · Style for triangle edges (linestyle,linewidth,color).background(RGBAColor | BaseColors) · Color for the inside area.
Return Value
(string) · The drawing ID of the created Triangle Pattern.
Example
Every 70 candles, a triangle is drawn using four pivots that outline consolidation.
//@version=1
init = () => {
indicator({ onMainPanel: true, format: 'inherit' });
};
onTick = () => {
if (index % 70 === 0) { // draw every 70 bars
// 1) Define four anchors
const A = newPoint(time(90), high(90));
const B = newPoint(time(75), low(75));
const C = newPoint(time(50), high(50));
const D = newPoint(time(30), low(30));
// 2) Define style
const style = {
fillBackground: true,
transparency: 80,
showLabels: true,
line: { linestyle: 0, linewidth: 2, color: color.orange },
background: color.rgba(255, 165, 0, 0.2)
};
// 3) Draw Triangle Pattern
trianglePattern(A, B, C, D, style);
}
};Tips
Works best when price contracts into the triangle before a breakout.
Use it alongside volume analysis — volume often drops during consolidation and spikes on the breakout.
Ascending triangles usually break upward; descending ones often break downward.
Warning
Avoid drawing triangles on random swings — the structure must clearly form converging or diverging trendlines.
Good Practice
Keep your style consistent across patterns so they’re recognizable at a glance.
Combine triangle patterns with support/resistance zones to filter false breakouts.
Last updated