XABCD Harmonics Indicator for NinjaTrader 8

Created 20 Jun 2025 · Updated 20 Jun 2025

The XABCD Harmonics indicator is a Premium Harmonic patterns auto-recognition indicator for the NinjaTrader 8 platform. Harmonic patterns profit from the natural order of the financial markets.

Prerequisites

To use this indicator you should have the following prerequisites available.


Description

The harmonic methodology utilizes the recognition of specific price patterns and the alignment of Fibonacci ratios to determine highly probable reversal points in the financial markets. This methodology assumes that trading patterns or cycles, like many patterns and cycles in life, repeat themselves. The key is to identify these patterns, and to enter or exit a position based upon a high degree of probability that the same historic price action will occur. Although these patterns are not 100% accurate, these situations have been historically proven. If these set-ups are identified correctly, it's possible to identify significant opportunities with a very limited risk.

Harmonics are 5-point patterns frequently referred to as XABCD patterns. The most well-known harmonic patterns are the Gartley, Bat, Crab, Butterfly, Shark, and Cypher patterns.

Those patterns are defined by swing points generally named X, A, B, C and D. These points define legs on which ratios can be calculated. For example, the AB/XA ratio is calculated by dividing the AB leg retracement by the XA price's initial move. When all of the legs respect a specific ratio rule set, those patterns are recognized.

Examples

These examples were hand-picked to show the best-case scenarios where the indicator detects valid patterns. In real-time trading, the patterns detected won't always lead to a winning trade, and you'll need to make decisions on whether to enter or skip a trade. These examples are all taken on the MES instrument on the 1-minute timeframe.

Gartley Pattern

The indicator allows setting a ratio tolerance in percentage to fine-tune the sensitivity of ratio detection. A higher tolerance value allows a higher number of detected patterns; a lower ratio tolerance results in fewer patterns detected.

The indicator also draws a horizontal ratio spanning the XB leg or the BD leg — this is the Time ratio, calculating the time ratio between the pattern's two halves (from the start point to point X, and from point B to point D). The ideal value of this ratio is 0.5 (50%), meaning the pattern is perfectly symmetrical.

Gartley Pattern definition
Click to enlarge
Gartley Pattern example
Click to enlarge
Bat Pattern

For an entry on a Bat pattern, one can wait for a red-candle confirmation after the pattern forms, and target point A or point C.

Bat Pattern definition
Click to enlarge
Bat Pattern example
Click to enlarge
Crab Pattern

For an entry on a Crab pattern, one can wait for a green-candle confirmation after the pattern forms, and target point A or point C. The indicator can also recognize and print two overlapping patterns sharing the same X, A, B and C swing points but with different D points — a valid occurrence that, in live trading, can be seen as a confirmation signal for the first pattern.

Crab Pattern definition
Click to enlarge
Crab Pattern example
Click to enlarge
Butterfly Pattern

For an entry on a Butterfly pattern, one can wait for a red-candle confirmation after the pattern forms, and target point A or point C. The Butterfly is the least effective pattern because it ends with price action opposite to the wanted trade direction — be careful with it.

Butterfly Pattern definition
Click to enlarge
Butterfly Pattern example
Click to enlarge
Shark Pattern

For an entry on a bullish Shark pattern, one can wait for a red-candle confirmation after the pattern forms, and target point A or point C.

Shark Pattern definition
Click to enlarge
Shark Pattern example
Click to enlarge
Cypher Pattern

The Cypher pattern follows the same recognition logic as the other harmonic patterns above.

Cypher Pattern definition
Click to enlarge
Cypher Pattern example
Click to enlarge

Parameters

We always try to keep the parameters to a minimum.

General
Swing PeriodSwings are higher lows, higher highs, lower highs and lower lows. After each price bar closes, a swing can take place, but the next bar (or the one after, etc.) can cancel it by creating a new swing of the same type. The swing period sets how many bars are enough to separate two swings of the same type — increasing this parameter decreases the overall number of swings (and produces wider, bigger patterns); decreasing it increases the number of swings (and produces condensed patterns).
Show Price SwingsControls showing/hiding the swing points.
Swings Bullish Color / Swings Bearish ColorSets the color of bullish/bearish swings, when shown.
Swings Opacity (1-100)Sets the opacity used to draw the swing markers.
Show RatiosEnables drawing ratio lines between the pattern legs with a dashed line and drawing the ratio number on it.
Show Patterns NamesEnables drawing the pattern name.
Font SizeSets the font size.
Show Gartley / Show Bat / Show Crab / Show Butterfly / Show Shark / Show CypherEnable/disable drawing each of these pattern types.
Per-Pattern Settings (Gartley, Bat, Crab, Butterfly, Shark, Cypher)
Bullish Color / Bearish ColorSets the color used to draw bullish/bearish instances of that pattern on the chart.
Ratio Tolerance %Sets the tolerance, in percentage, on that pattern's leg ratio rules. For example, a 10% tolerance on a leg ratio that should be around 0.368 allows the actual leg ratio to fall between 0.368 - 10% and 0.368 + 10%.
Sound Alert
Play Sound AlertEnables playing an alert sound when a pattern is detected.
Play Sound FileSets the file name to be played on sound alert — any .wav file on your computer.

Download & Installation Instructions

License Requirements

At automated-trading.ch you can choose to either purchase a monthly subscription to use our premium products, or use our free products without subscribing.

In both cases, you need to create an account so you can get a License you can use for both premium and free products.

To obtain your license, simply sign up and then get your license on the billing page.

Important: This is a Premium product. It can be run in Backtest, Playback, and Optimization modes for free; an active Premium subscription is required to run it live.
Download
Sign in to download this file.
Latest Version v1.0.0.0 · Published 1 year ago
This file was downloaded 114 times. Last download was 1 day ago.

You can also download this strategy — and every other automated-trading.ch strategy or indicator — anytime from your centralized Downloads page.

Installation Steps
1
Import the downloaded .zip file into NinjaTrader using the Import NinjaScript menu item.
2
Open a new chart window.
3
Right-click the chart and choose Indicators... to add the indicator to the chart.
4
Copy/paste your license key, found on the billing page, into the License parameter.
5
After adding the indicator to the chart with a valid license, it will run on the chart's historical data first, then continue running on live market data.

Frequently Asked Questions

General

Yes — if you have an idea that you believe can improve this indicator, use the contact page to send us a message.

No, the source code of the indicator is protected for copyright reasons.

Yes, you can use this indicator without TickReplay, but bear in mind that in this case the indicator will not detect events on historical candles — it will only start detecting them on real-time volume and price data.

Yes, in some cases, a pattern recognized and drawn on the chart can be removed if it's invalidated on the first following candle. Invalidation means the candle closes below the D swing point for a bullish pattern, and closes above the D swing point for a bearish pattern.

Release Notes

  • First Release of the indicator
discord
Join our Discord community
Questions, feedback, or just want to chat with other traders? Come say hi.
Join Discord
Quick Facts
Platform NinjaTrader 8
Category Indicator
Plan Required Premium
Latest Version v1.0.0.0
Last Updated 1 year ago
Downloads 114