Selecciones de los editoresOPEN-SOURCE SCRIPT

Auto Chart Patterns [Trendoscope®]

Actualizado
🎲 Introducing our most comprehensive automatic chart pattern recognition indicator.

Last week, we published an idea on how to algorithmically identify and classify chart patterns.
Algorithmic Identification and Classification of Chart Patterns


This indicator is nothing but the initial implementation of the idea. Whatever we explained in that publication that users can do manually to identify and classify the pattern, this indicator will do it for them.

🎲 Process of identifying the patterns.

The bulk of the logic is implemented as part of the library - chartpatterns. The indicator is a shell that captures the user inputs and makes use of the library to deliver the outcome.

🎯 Here is the list of steps executed to identify the patterns on the chart.
  • Derive multi level recursive zigzag for multiple base zigzag length and depth combinations.
  • For each zigzag and level, check the last 5 pivots or 6 pivots (based on the input setting) for possibility of valid trend line pairs.
  • If there is a valid trend line pair, then there is pattern.


🎯 Rules for identifying the valid trend line pairs
  • There should be at least two trend lines that does not intersect between the starting and ending pivots.
  • The upper trend line should touch all the pivot highs of the last 5 or 6 pivots considered for scanning the patterns
  • The lower trend line should touch all the pivot lows of the last 5 or 6 pivots considered for scanning the patterns.
  • None of the candles from starting pivot to ending pivot should fall outside the trend lines (above upper trend line and below lower trend line)


The existence of a valid trend line pair signifies the existence of pattern. What type of pattern it is, to identify that we need to go through the classification rules.

🎲 Process of classification of the patterns.

We need to gather the following information before we classify the pattern.
  • Direction of upper trend line - rising, falling or flat
  • Direction of lower trend line - rising, falling or flat
  • Characteristics of trend line pair - converging, expanding, parallel


🎯 Broader Classifications
Broader classification would include the following types.

🚩 Classification Based on Geometrical Shapes
This includes
  • Wedges - both trend lines are moving in the same direction. But, the trend lines are either converging or diverging and not parallel to each other.
  • Triangles - trend lines are moving in different directions. Naturally, they are either converging or diverging.
  • Channels - Both trend lines are moving in the same direction, and they are parallel to each other within the limits of error.


🚩 Classification Based on Pattern Direction
This includes
  • Ascending/Rising Patterns - No trend line is moving in the downward direction and at least one trend line is moving upwards
  • Descending/Falling Patterns - No trend line is moving in the upward direction, and at least one trend line is moving downwards.
  • Flat - Both Trend Lines are Flat
  • Bi-Directional - Both trend lines are moving in opposite direction and none of them is flat.


🚩 Classification Based on Formation Dynamics
This includes
  • Converging Patterns - Trend Lines are converging towards each other
  • Diverging Patterns - Trend Lines are diverging from each other
  • Parallel Patterns - Trend Lines are parallel to each others


🎯 Individual Pattern Types
Now we have broader classifications. Let's go through in detail to find out fine-grained classification of each individual patterns.

🚩 Ascending/Uptrend Channel
This pattern belongs to the broader classifications - Ascending Patterns, Parallel Patterns and Channels. The rules for the Ascending/Uptrend Channel pattern are as below
  • Both trend lines are rising
  • Trend lines are parallel to each other

imagen

🚩 Descending/Downtrend Channel
This pattern belongs to the broader classifications - Descending Patterns, Parallel Patterns and Channels. The rules for the Descending/Downtrend Channel pattern are as below
  • Both trend lines are falling
  • Trend lines are parallel to each other

imagen

🚩 Ranging Channel
This pattern belongs to the broader classifications - Flat Patterns, Parallel Patterns and Channels. The rules for the Ranging Channel pattern are as below
  • Both trend lines are flat
  • Trend lines are parallel to each other

imagen

🚩 Rising Wedge - Expanding
This pattern belongs to the broader classifications - Rising Patterns, Diverging Patterns and Wedges. The rules for the Expanding Rising Wedge pattern are as below
  • Both trend lines are rising
  • Trend Lines are diverging.

imagen

🚩 Rising Wedge - Contracting
This pattern belongs to the broader classifications - Rising Patterns, Converging Patterns and Wedges. The rules for the Contracting Rising Wedge pattern are as below
  • Both trend lines are rising
  • Trend Lines are converging.

imagen

🚩 Falling Wedge - Expanding
This pattern belongs to the broader classifications - Falling Patterns, Diverging Patterns and Wedges. The rules for the Expanding Falling Wedge pattern are as below
  • Both trend lines are falling
  • Trend Lines are diverging.

imagen

🚩 Falling Wedge - Contracting
This pattern belongs to the broader classifications - Falling Patterns, Converging Patterns and Wedges. The rules for the Converging Falling Wedge are as below
  • Both trend lines are falling
  • Trend Lines are converging.

imagen

🚩 Rising/Ascending Triangle - Expanding
This pattern belongs to the broader classifications - Rising Patterns, Diverging Patterns and Triangles. The rules for the Expanding Ascending Triangle pattern are as below
  • The upper trend line is rising
  • The lower trend line is flat
  • Naturally, the trend lines are diverging from each other

imagen

🚩 Rising/Ascending Triangle - Contracting
This pattern belongs to the broader classifications - Rising Patterns, Converging Patterns and Triangles. The rules for the Contracting Ascending Triangle pattern are as below
  • The upper trend line is flat
  • The lower trend line is rising
  • Naturally, the trend lines are converging.

imagen

🚩 Falling/Descending Triangle - Expanding
This pattern belongs to the broader classifications - Falling Patterns, Diverging Patterns and Triangles. The rules for the Expanding Descending Triangle pattern are as below
  • The upper trend line is flat
  • The lower trend line is falling
  • Naturally, the trend lines are diverging from each other

imagen

🚩 Falling/Descending Triangle - Contracting
This pattern belongs to the broader classifications - Falling Patterns, Converging Patterns and Triangles. The rules for the Contracting Descending Triangle pattern are as below
  • The upper trend line is falling
  • The lower trend line is flat
  • Naturally, the trend lines are converging.

imagen

🚩 Converging Triangle
This pattern belongs to the broader classifications - Bi-Directional Patterns, Converging Patterns and Triangles. The rules for the Converging Triangle pattern are as below
  • The upper trend line is falling
  • The lower trend line is rising
  • Naturally, the trend lines are converging.

imagen

🚩 Diverging Triangle
This pattern belongs to the broader classifications - Bi-Directional Patterns, Diverging Patterns and Triangles. The rules for the Diverging Triangle pattern are as below
  • The upper trend line is rising
  • The lower trend line is falling
  • Naturally, the trend lines are diverging from each other.

imagen

🎲 Indicator Settings - Auto Chart Patterns

🎯 Zigzag Settings
Zigzag settings allow users to select the number of zigzag combinations to be used for pattern scanning, and also allows users to set zigzag length and depth combinations.

imagen

🎯 Scanning Settings
  • Number of Pivots - This can be either 5 or 6. Represents the number of pivots used for identification of patterns.
  • Error Threshold - Error threshold used for initial trend line validation.
  • Flat Threshold - Flat angle threshold is used to identify the slope and direction of trend lines.
  • Last Pivot Direction - Filters patterns based on the last pivot direction. The values can be up, down, both, or custom. When custom is selected, then the individual pattern specific last pivot direction setting is used instead of the generic one.
  • Verify Bar Ratio - Provides option to ignore extreme patterns where the ratios of zigzag lines are not proportionate to each other.
  • Avoid Overlap - When selected, the patterns that overlap with existing patterns will be ignored while scanning. Meaning, if the new pattern starting point falls between the start and end of an existing pattern, it will be ignored.

imagen

🎯 Group Classification Filters
Allows users to enable disable patterns based on group classifications.

🚩 Geometric Shapes Based Classifications
  • Wedges - Rising Wedge Expanding, Falling Wedge Expanding, Rising Wedge Contracting, Falling Wedge Contracting.
  • Channels - Ascending Channel, Descending Channel, Ranging Channel
  • Triangles - Converging Triangle, Diverging Triangle, Ascending Triangle Expanding, Descending Triangle Expanding, Ascending Triangle Contrcting and Descending Triangle Contracting


🚩 Direction Based Classifications
  • Rising - Rising Wedge Contracting, Rising Wedge Expanding, Ascending Triangle Contracting, Ascending Triangle Expanding and Ascending Channel
  • Falling - Falling Wedge Contracting, Falling Wedge Expanding, Descending Triangle Contracting, Descending Triangle Expanding and Descending Channel
  • Flat/Bi-directional - Ranging Channel, Converging Triangle, Diverging Triangle


🚩 Formation Dynamics Based Classifications
  • Expanding - Rising Wedge Expanding, Falling Wedge Expanding, Ascending Triangle Expanding, Descending Triangle Expanding, Diverging Triangle
  • Contracting - Rising Wedge Contracting, Falling Wedge Contracting, Ascending Triangle Contracting, Descending Triangle Contracting, Converging Triangle
  • Parallel - Ascending Channel, Descending Channgel and Ranging Channel


imagen

🎯 Individual Pattern Filters
These settings allow users to enable/disable individual patterns and also set last pivot direction filter individually for each pattern. Individual Last Pivot direction filters are only considered if the main "Last Pivot Direction" filter is set to "custom"

imagen

🎯 Display Settings
These are the settings that determine the indicator display. The details are provided in the tooltips and are self explanatory.
imagen

🎯 Alerts
A basic alert message is enabled upon detection of new pattern on the chart.
Notas de prensa
Added option to enable/disable repainting.

When permitted, repainting only updates a pattern if the new coordinates yield a more geometrically accurate representation. While repainting can be beneficial for maintaining precise patterns on the chart, it often carries a negative connotation. Therefore, we've set this option to be off by default, allowing users to choose based on their preferences
Notas de prensa
Updates

  • Added option to detect patterns based on custom OHLC. This means, users can select external inputs and apply the pattern detection algorithm on oscillators or other indicators provided they have their OHLC values and not a single value.
  • Added option to limit number of patterns on chart.
Notas de prensa
Library Updates
Notas de prensa
Minor library updates
Notas de prensa
Update libraries
autochartingChart patternsHarmonic PatternshewhomustnotbenamedtrendoscopeZig Zag Indicator

Script de código abierto

Siguiendo fielmente el espíritu de TradingView, el autor de este script lo ha publicado en código abierto, permitiendo que otros traders puedan entenderlo y verificarlo. ¡Olé por el autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la reutilización de este código en la publicación se rige por las Normas internas. Puede añadir este script a sus favoritos y usarlo en un gráfico.

¿Quiere utilizar este script en un gráfico?

Exención de responsabilidad