Editors' picks
OPEN-SOURCE SCRIPT

Custom Pattern Detection

Overview

Chart Patterns is a major tool for many traders. Pattern formation at specific location on the chart is used for investment/trading decisions.
This indicator is designed in a way to allow investors/traders to define patterns of their choice based on certain input parameters and then detect defined pattern on the chart.
Investors/traders can use their own creativity to create and detect patterns.
This indicator works in 2 modes
  1. Create Pattern: One can define a pattern and verify sample pattern formation visually
  2. Detect Pattern: Detect and mark patterns on the chart


Settings

Create Custom Pattern:

Show Custom Pattern – This will mark the pattern lines on the chart so that one can verify how pattern appears based on the input’s parameters provided for lines XA, AB, BC, CD, DE, EF

Offset – Used while pattern creation. Offset is horizonal distance between 2 lines.

XA Points – Used to draw XA line when sample pattern is drawn. XA points can be a negative or position number.

XA line is drawn based on Offset and XA Points. E.g. Offset = 5 and XA Points = -20. In this line would be drawn from last candle high to high – 20 (these are y1 and y2 points of a line). While drawing line distance of 5 candles would be placed between 2 line points (these are x1 and x2 points of a line). In XA line X forms start point and A forms end point of the line.
Line AB – Line AB is drawn from point X. To derive the end point of AB, average Fib% is derived based on From Fib% and To Fib% parameters. Finally end point is derived by applying Fib Retracement on Line XA based on average Fib%.

Line AB to Line EF – These points are derived as explained in Line AB.
The indicator can be used to define/create patterns up to 6 legs/lines. The line would be named as XA -> AB -> BC -> CD -> DE -> EF.
If one wish to create pattern consisting 3 legs then it can be achieved by unchecking/deselecting Line CD, DE and EF or by checking only Line AB and BC.

Based on the parameters above indicator draws a sample pattern after last candle/bar on the chart. Sample pattern helps to visually see how pattern will appear on the chart.

Pattern Identification

Indicator derive the swing high/low points based on the Pivot lookback and use as reference points while detecting patterns.
Use of From Fib% and To Fib% - While detecting pattern, retracement price points are derived for From Fib% and To Fib%. Price points between from Fib% and To Fib% are treated as valid retracement points.

How to configure and use indicator for detecting patterns
Sample Pattern 1
snapshot

Sample Pattern 2
snapshot

Sample Pattern 3
snapshot

Sample Pattern 4
snapshot
Chart patternseducationalHarmonic Patterns

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer