Auto Harmonic Pattern UltimateX - Settings Guide

Auto Harmonic Pattern UltimateX
Auto Harmonic Pattern UltimateX

Auto Harmonic Patterns UltimateX is one of the complex indicators we have built. It comes with plenty of customisation options via input parameters. Lets dive deep into it and learn more about it

Link to the Indicator: Auto Harmonic Pattern UltimateX

Auto Harmonic Patterns UltimateX

Auto Harmonic Pattern UltimateX is created to supersede the existing indicator Auto Harmonic Pattern Ultimate. The script deviates a lot from the original Auto Harmonic Pattern Ultimate script in terms of the number of available patterns, trading type and a few other things. Hence, instead of updating the existing script, we have just decided to release it as a new script. 

Following are the major highlights/updates in the present script

  • Uses a single zigzag instead of a multi as the algorithm is further improved to detect almost everything using a single zigzag.
  • More patterns were added. But, new patterns are disabled by default as some of them have very wide PRZ. Users can enable it via settings.
  • Trading type with trailing entry - With wide PRZs, we also had to implement a different method for calculating entry/stop. This is explained later in the script.
  • Matrix implementation and enhanced stats - Entire implementation is redesigned to use a matrix data structure instead of arrays. This allows lots of possibilities including enhanced closed trade stats.

Below are the inherited major features

  • Extensive settings which allow users to make modifications to the output in various ways
  • Fully customisable alerts based on the settings to enable easy translations to bot-based webhooks.

Diving Deep in the Harmonic Patterns

Patterns Included

  • Classic Patterns
    • Gartley
    • Bat
    • Butterfly
    • Crab
    • Deep Crab
    • Cypher
    • Shark
    • Nenstar
  • Anti Patterns
    • Anti Nenstar
    • Anti Shark
    • Anti Cypher
    • Anti Crab
    • Anti Butterfly
    • Anti Bat
    • Anti Gartley
    • Navarro200
  • Non-Standard Patterns (Disabled by default)
    • Five-Zero
    • Three Drives
    • White Swan
    • Black Swan
    • Sea Pony
    • Leonardo
    • 121
    • Snorm
    • Total

Chart Components

Below is a quick snapshot of the components involved. When you load the indicator on the chart, you will notice the following components.

  • Patterns Drawings on Chart - Please note that patterns do not need to be on the chart all the time.
  • Calculated levels based on indicator settings - potential reversal zone (prz), entry, stop, targets
  • Open Trades Statistics Table - displaying a complete list of patterns on the chart
  • Closed Trades Statistics Table - Displaying the detailed statistics of closed trades
Auto Harmonic Pattern UltimateX - Display Components
Auto Harmonic Patterns UltimateX - Chart Components

Open Trades Statistics Table

Targets are calculated only when an entry is made. Hence, target details are not shown for patterns where it is still awaiting entry.

Apart from regular stats, it also contains different types of risk-reward ratios.

  • Regular RR: RR calculated from entry to reach the target with initial stop for risk consideration
  • Trailing RR: This is RR calculated for the price to reach from one target to the next target considering trailing stop for calculating risk
  • Live RR: This is calculated based on the current price as entry and with given targets and stop levels. Live RR will be blank for targets that are already reached.
Auto Harmonic Pattern UltimateX - Open Stats Table
Auto Harmonic Patterns UltimateX - Open Stats Table

Closed Trades Statistics Table

Closed stats has several display modes

  • Percentage and Risk Reward
  • Absolute Count with Size and Duration
  • Absolute Count with Size and Duration - Include Invalid and Stopped States

Percentage and Risk Reward

This mode present average Risk Reward, Trailing Risk Reward, Average Win Rate, and Average Trailing Win Rate for all the possible levels.
  • Regular RR: RR calculated from entry to reach the target with the initial stop for risk consideration
  • Trailing RR: This is RR calculated for the price to reach from one target to the next target considering trailing stop for calculating risk
  • Win Rate: Simple win rate calculation based on the number of patterns that reached the target and the number of valid patterns.
  • Trailing Win Rate: This is the win rate calculated based on the previous target to the current target.

For example, if there are 48 valid patterns and out of which 24 patterns reach the target1 and 12 patterns out of 24 reach target 2

  • Target1 WR: 50% (24/48)
  • Target1 TWR: Not applicable as there is no target before Target1
  • Target2 WR: 25% (12/48)
  • Target2 TWR: 50% (12/24)
Auto Harmonic Pattern UltimateX - Closed Stats Table
Auto Harmonic Patterns UltimateX - Closed Stats Table

Absolute Count with Size and Duration

In this mode, instead of presenting win ratio and risk reward, the closed trades stats display
  • Absolute number of patterns identified for each type and the resulting status. 
  • Average or Median size of patterns for each type and status.
  • Average or Median duration the pattern took for reaching particular status for each type and status.
Count based stats for Auto Harmonic Pattern UltimateX
Count based stats for Auto Harmonic Pattern UltimateX

Absolute Count with Size and Duration - Include Invalid and Stopped

This is same as the previous option but here we also display invalid and stopped patterns which otherwise we do not display. 

These status are not displayed in Percentage mode as they are implied by default. For example, the total column has 3 counts - Retested / Valid / Total. 

In order to get Invalid counts, we just need to take the difference between Total and Valid. Also, to understand the number of stopped orders, we just need to look at the win ratio of the Target 1.

But, in case of Size and Duration, these details cannot be derived from other stats. Hence, we are providing this third option to display the stats including invalid and stopped patterns for the count/size/duration display mode.

Count/Size/Duration mode with Invalid and Stopped Patterns
Count/Size/Duration mode with Invalid and Stopped Patterns

Auto Harmonic Pattern UltimateX - Settings

Settings are straightforward and you will be able to understand them by exploring each of them. Plenty of information is provided in tooltips to explain the impact of each input.

Generic Settings

These properties are generic in nature and does not belong to other major categories of settings listed afterwards. This include.

  • Theme - Chart theme settings. Line and label colors are generated based on the theme settings. If dark theme is selected lighter colors are used and if light theme is selected, darker colors are used.
  • Trade Direction - Use this to filter only bullish or bearish projections. Please note that the trade direction of bullish projection is short and that of bearish projection is long
  • Max Live Patterns - Max number of projections allowed on chart at any time. If exceeds, the oldest pattern on chart will be removed. But, they are still kept in memory and continue to generate alerts and perform other calculations.
  • Error Percent - Error threshold for calculation on projections. Increased error threshold will reduce the accuracy of projections. Lower error threshold will reduce number of projections detected.
  • Use Only Confirmed Bars - If enabled, all the calculations are performed based on the confirmed bar. Hence, there will be a lag of 1 bar and the updates will not be real time.
  • Perfect Triangles - If enabled, only projections where price has not crossed XB (Perfect looking triangles) will be picked
  • Trail Entry Price - If enabled, the entry price of the pattern will trail along with the trailing D pivot. If disabled, entry and targets are not recalculated based on the trailing D.
  • Ignore if closed above entry - Pattern is ignored if it closes above Entry on the same bar as pattern detection. This can be used to avoid stats repainting. Also to avoid patterns that are too volatile. This setting is only applicable if using real time bars for calculation (Use confirmed bars option unchecked
  • Suppress Scanning Beyond Max - If enabled, then number of patterns are restricted to 10 and if the chart already has 10 patterns, no new scanning is done until the older patterns are closed.
  • Strict Scanning Mode - If selected, the error thresholds are not added when the from-ratio and to-ratio of the projection are different. This will lead to more accurate projections however less number of projections will be scanned.
  Auto Harmonic Pattern UltimateX - Generic Settings

Log Scale

Enables users to make calculations in log scale instead of linear scale.

  • Scanning - Use log scale instead of linear scale for scanning patterns
  • Targets - Use log scale instead of linear scale for calculation of targets and stops
Auto Harmonic Pattern UltimateX - Log Scale Settings

Zigzag Settings

Zigzags are basic building blocks for any pattern scanning algorithms. The selection greatly impacts the size and type of patterns being scanned. 

Users can use either recursive zigzag algorithm or deep search algorithm. Both highly depend on zigzag depth parameter. In recursive zigzag, you can also select the level of zigzag to be used for scanning projections.

Auto Harmonic Pattern UltimateX - Zigzag Settings


Filters further allow users to be more selective and select the patterns of their choice or their condition. By default all the filters are disabled. Filters available in this indicator are of following types.

Auto Harmonic Patterns UltimateX - Filter Settings
  • Size - Filter based on number of bars the projection is spawning.
  • Size(%) - Filter based on the size in terms of price.
  • Custom External Filter - Define your filter script and use them with the indicator. Example filters can be found in the Filters Page
Here is a detailed video on how to use external filters

Trade Target And Trailing

These settings are to customise your entry, stop, target and trailing configurations. Please note that these settings highly impact both the risk-reward and win ratio of historical and possible future trades.

Please note that using a lower entry ratio may cause repainting. Due to pine limitations, we do not have intrabar data prices and hence it will be difficult to programmatically identify if the entry reached before stop or the other way around when volatility is high and price movements are violent. The minimum suggested value for entry is 10%. But, it is always better to use a higher value.

Auto Harmonic Pattern UltimateX - Trailing and Target Settings
Auto Harmonic Patterns UltimateX - Trailing and Target Settings

Pattern Filters

These settings let the users choose patterns individually or by category. By default, Classic and Anti Patterns are enabled and Non-Standard patterns are disabled. But, if you have a preference to use any particular patterns, or study patterns one by one, these configurations will be really helpful to achieve that.

Auto Harmonic Pattern UltimateX - Pattern Filter
Auto Harmonic Patterns UltimateX - Pattern Filter

Stats and Display

This section contains display related controls. Overall provides option for users to enable/disable, control display position, size and fill of following attributes

  • Open Projections
  • Closed Stats
  • Timer
  • Targets
  • XABC Pivots
  • Ratios
  • Fill Levels of major and minor triangles
Auto Harmonic Projection - Stats and Display Settings

We further have separate settings for Open Stats and Closed Stats Table.

Open Stats Table has following Options

  • Percentage - Display Percentage gain or loss for each targets and stops.
  • Risk/Reward - Display Calculated risk reward for each targets.
  • Enhanced Risk Reward - Display enhanced RR stats such as trailing Risk Reward and Live Risk reward in open stats table.

Closed Stats Table has these options

  • Median - This setting is applicable only for Size and Duration statistics. If selected, median value of size and duration are calculated and presented in the stats. Otherwise, an average will be taken.
  • Display Modes represents what all patterns data to be shown on the tables. Here are the options.
    • Detailed - All patterns data are shown in the table.
    • Selective - Only the open patterns data are shown in the table along with combined stats
    • Compact - Only combined stats for bullish and bearish patterns are shown on the table.
  • Display Type represents what data is displayed in the table. Following are the options.
    • Percentage/Risk Reward
    • Count/Size/Duration
    • Count/Size/Duration (Including Invalid and Stopped Patterns)
Open/Closed Stat Settings

Alerts Settings

Alerts are implemented using Pinescript's alert function instead of alertcondition. Hence, users will not see the option to customise alerts in the alert widget. In order to overcome that, we have implemented fully customisable alerts embedded within the settings. These are the different types of alerts supported.

  • New - Fires when a new pattern is identified
  • Entry - Fires when a pattern reaches entry based on settings used
  • Target1 to Target4 - Fires when patterns reach specific target levels
  • Stop - Fires when a pattern is stopped out.
  • Invalidation - Fires when pattern is invalidated. Meaning, hits stop before hitting the entry.
  • Closure - Fire whenever a pattern is closed. A Closure reason can be either target 4 reached, stopped or invalidated.
  • Summary - Fires on each bar with a summary of existing patterns. This alert is disabled by default.
Pattern Status - New, Entry, Targets 1-4
Pattern Alerts on Stop, Invalidation, Closure or Summary

Each alert type can be individually enabled or disabled. Please bear in mind that once the settings are changed, alerts need to be deleted and recreated again. Changing the settings on the chart will not change it automatically on alerts. This is because alerts are run in the cloud as separate instances and will only take into consideration the settings which were set while creating the alerts.

Auto Harmonic Pattern Ultimatex provides various placeholders that can be used in framing the customisable alerts. Here are the different placeholders that can be used.

  • {type} - Alert Type. (New, Entry, Update, Closure, Summary)
  • {id} - Unique pattern Id
  • {ticker} - Ticker for which pattern is generated
  • {timeframe} - Chart timeframe
  • {basecurrency} - Base currency of ticker
  • {quotecurrency} - Quote currency of ticker
  • {pivots} - Array containing pivots X, A, B, C, D
  • {price} - Current price
  • {patterns} - Array containing a list of patterns recognised
  • {direction} - Long or Short
  • {entrydirection} - Actual trade direction of entry for the given pattern. Possible values are "buy" and "sell".
  • {exitdirection} - Actual trade direction of exit for the given pattern. Possible values are "buy" and "sell".
  • {entry} - Entry Price
  • {stop} - Stop Price
  • {tstop} - Trailing stop price
  • {firsttarget} - First target from the list of targets
  • {lasttarget} - Last target from the list of targets
  • {targets} - All targets in an array [target1, target2, target3, target4]
  • {laststatus} - Last pattern Status (Applicable only for status update)
  • {status} - Pattern Status
  • {result} - Result of the pattern trade (Applicable only for pattern closure alerts)

Further, we also provide input settings to customise the value of {direction}, {entrydirection} and {exitdirection} placeholders.

This is done keeping in mind about the ability to use third party tools for auto trading. Some systems would expect input to be long/short whereas others as buy/sell and some may even just give you different identifiers for long and short. Such requirements can be fulfilled by using the custom direction labels.

Customise Direction Labels

We also provide comprehensive placeholders for alerts which can be used for customising them. To learn more about customising alerts using templates, please follow this tutorial - "Fully Customisable Alerts Using Alert Placeholders"

Safe Repaint

The term safe repaint refers to repainting the display without impacting the trade signals generated. To learn more about repainting please visit the article - "Repainting - Complete Guide"

Auto Harmonic Patterns UltimateX uses safe repainting when the trailing entry option is enabled. It means that patterns and entries are allowed to change only before reaching the entry. Once entry is reached, patterns are locked till they hit stop or target.

Here is a short video demonstrating how safe repaint works in Auto Harmonic Patterns UltimateX

Video Tutorial

Prefer watching videos instead of reading, here is a video tutorial.