Harmonics XABCD Strategy
Created 12 Jul 2025
·
Updated 12 Jul 2025
The Harmonics XABCD Strategy is a Premium mechanical strategy for the NinjaTrader 8 platform. The strategy can be used to pass trader funding programs.
Prerequisites
To properly use this strategy you should have the following prerequisites available.
- NinjaTrader 8, with any license type. Click here to download
- An automated-trading.ch account with an active Premium Subscription
Important Disclaimer
We strongly recommend that you never run your algorithmic trading systems on your hard-earned real money. You should always minimize your risk and run your strategies on trader funding programs, so the maximum amount you risk losing is the monthly subscription fee you pay those programs.
This strategy is based on entering trades following XABCD harmonic patterns. These patterns are defined by swing points generally named X, A, B, C, and D, which define legs that ratios can be calculated on — for example, the AB/XA ratio, obtained by dividing the AB leg's retracement by the XA leg's initial move. When every leg respects a specific ratio rule set, the pattern is recognized.
If you want to learn more about XABCD harmonic patterns, have a look at the Harmonics XABCD indicator page.
Entry Setup Examples
The following examples were handpicked to show best-case scenarios where the recognition engine detects valid patterns. In real-time trading, a detected pattern won't always lead to a winning trade — that's the reality of trading, where the goal is long-term profitability rather than a guaranteed win on every signal. All examples below are taken on the MES instrument on the 1-minute timeframe.
Example #1: Bullish Butterfly
The strategy recognized a bullish butterfly pattern. One bar after the pattern was detected, the strategy entered a long trade targeting 1.5x the stop distance (the D swing price of the pattern), leading to a winning trade. In this example, the strategy is set to enter immediately on bar close, without waiting for a confirmation bar.
Example #2: Overlapping Butterfly Patterns
This example shows an aspect of the strategy that occurs often: overlapping patterns. Two butterfly patterns were detected on top of each other — in this case the strategy enters on the first valid pattern.
Example #3: Bullish Gartley Following the Trend
The Gartley XABCD harmonic pattern is a trend-following pattern. Two consecutive trades were taken from two Gartley patterns aligned with the trend.
Example #4: Loss Avoided With the Trend Filter
This example illustrates the Trend Filter avoiding trades counter to the trend. The filter analyzes swing points to determine the prevailing direction — an upward sequence of swing points restricts the strategy to long entries only, which avoided two losing short trades on this chart that would otherwise have triggered from valid Gartley patterns against the trend.
Features
The Harmonics XABCD strategy has a set of unique features:
- Robust in-house implementation of the XABCD harmonics pattern-recognition algorithm
- No pending orders are placed — only market orders, which produces no rejected or partially filled orders
- Full-auto strategy that can be scaled into unlimited instances with a single license
- Precise backtesting capabilities following NinjaTrader's official best practices, achieving precise entry/exit backtesting at the tick level
- A robust in-house order management library, resistant to connection loss, that works seamlessly on Rithmic or Tradovate accounts
- On-chart command buttons to manually manage positions when needed
- A very lightweight strategy that can run in multiple instances even on a low-power VPS
Dynamic Quantity and Risk Management
As with all our strategies, this strategy implements two methods for setting the quantity of open positions:
- Fixed Quantity: uses the same quantity for every position. If the stop loss is variable between positions, win/loss amounts will vary too.
- Dynamic Risk-Adjusted Quantity: calculates each position's quantity from its stop loss, the maximum risk (in $) allowed per position, and the maximum allowed quantity — producing equal win/loss amounts across all positions regardless of stop loss width.
Position Management
As with all our strategies, this strategy implements multiple position management methods:
- ATM Strategy: delegate position management entirely to your own ATM strategy, selected from a drop-down.
- Classical Trailing Stop: trails the stop loss based on a trigger and a trailing amount.
The strategy also allows setting the stop loss based on multiple strategies and the take profit based on a ratio — see the Parameters section for details.
Account Management
The strategy implements daily stop-trading triggers based on the net winning position count, the net losing position count, or a target realized net profit or net loss.
Parameters
We try to keep the parameters to a minimum — only the most important are exposed.
| General | |
| Execute Historical Trades | Enables executing trades when the strategy runs in Historical, Backtest, or Optimization mode — useful to test performance on past days, but should be unchecked when running Live. |
| Daily TakeProfit Target | The strategy stops for the day once this daily take-profit amount is reached. Ignored when set to 0. |
| Daily StopLoss Limit | The strategy stops for the day once the daily loss limit is reached (positive value — e.g. 300 stops trading once realized PnL ≤ -$300). Ignored when set to 0. |
| Stop @ Winning Count | Stops trading for the day once the net winning-trade count reaches this value. Ignored when set to 0. |
| Stop @ Losing Count | Stops trading for the day once the net losing-trade count reaches this value. Ignored when set to 0. |
| Execute on Different Instrument | Executes trades on a different instrument than the active chart's — e.g. run logic on Minis but execute on Micros. All risk calculation happens on the execution instrument, and trades on a different instrument aren't drawn on the chart. |
| Execution Instrument | Choose from a list of Micros available on your NinjaTrader connection as the instrument trades execute on. Trades won't be drawn on the chart in this case. |
| Order Label | A label suffixed to every position sent to the broker, useful to differentiate your orders from other users of the same strategy. |
| Enable/Disable Trading Days |
Restricts trading on certain weekdays.
|
| XABCD Harmonics | |
| Swing Period | Sets how many bars must separate two swings of the same type before a new swing invalidates the previous one. Increasing this parameter reduces the overall number of swings detected; decreasing it increases them. It has a significant impact on pattern quality — more swings mean more patterns, and vice versa. |
| Show Price Swings | Enables/disables drawing a mark below/above swing price points — useful to see how market structure is analyzed, since swing points are the building blocks of the pattern-recognition algorithm. |
| Swing Bullish Color / Swing Bearish Color | Sets the color brush used for low (bullish) and high (bearish) swing points. |
| Swing Opacity (1-100) | Opacity of the swing points drawing — 1 is transparent, 100 is fully opaque. |
| Enable Gartley / Enable Bat / Enable Crab / Enable Butterfly / Enable Shark / Enable Cypher | Enables/disables trading each specific harmonic pattern. |
| Gartley/Bat/Crab/Butterfly/Shark/Cypher Ratio Tolerance % | Sets the tolerance, in percentage, applied to each pattern's leg ratio rules — e.g. with a 10% tolerance, a leg ratio that should be around 0.368 can range between 0.368 - 10% and 0.368 + 10%. |
| Entry Setup | |
| Time Zone |
The time zone used for the Trade Time parameter below. Futures markets operate on US Eastern time (EST), so this lets you specify the trading interval relative to your own machine's time zone instead.
|
| Trade Time (hh:mm-hh:mm,...) | Time interval sequence during which the strategy is allowed to place trades — e.g. 09:30-16:15 for regular trading hours in EST. Multiple intervals can be listed in increasing order, e.g. "00:01-08:00,09:55-15:55,18:01-23:59" to cover extended hours with a gap around a volatile period, cut at midnight to avoid day-rollover issues. |
| Quantity Strategy |
|
| Max Qty | Maximum allowed quantity when Risk Adjusted is selected — useful since some prop firms enforce order-quantity limits that can invalidate an account. |
| Entry Mode |
The trigger used to enter a trade once an XABCD pattern is recognized and validated.
|
| SuperTrend Entry Filter | Restricts long entries to when SuperTrend is bullish and short entries to when it's bearish. |
| Swing Trend Entry Filter | Filters entries by comparing the XABCD pattern's first swing point to the previous price swing — a bullish entry requires the previous swing to be below the pattern (continuation of an uptrend), and a bearish entry requires it to be above. |
| Order Qty | Used only when Quantity Strategy is Fixed — the fixed quantity per trade. |
| Order Management | |
| Order Management Strategy |
|
| ATM Strategy Template Name | Only used with the ATM Strategy order management method — the exact template name of your custom ATM strategy. Must match an existing template, or no position will be opened. |
| Scale out % Qty at % Target | Closes a percentage of the position's quantity once price hits a percentage of the profit target (rounded down when fractional — e.g. 50% of a 5-lot position closes 2 contracts). |
| Scale out at % Target | The percentage of the profit target that triggers the scale-out mechanism. |
| Scale out % Qty | The percentage of the quantity closed by the scale-out mechanism. |
| Enable Price Breakeven | Enables/disables the price-based breakeven mechanism. |
| Breakeven Price Strategy |
|
| Breakeven Price Trigger | Available if price-based breakeven is enabled — the trigger value needed to move the stop loss to breakeven. |
| StopLoss Strategy |
|
| TakeProfit Strategy |
|
| Target Risk Per Trade ($) | Maximum risk, in dollars, per position — used before opening a trade to verify the calculated stop loss respects this limit; if not, the trade is skipped. |
| Max Allowed Risk Per ($) | Only used with Risk Adjusted quantity — controls how far the real calculated risk is allowed to deviate from the Target Risk (since an exact match is rarely possible). |
| Stop Loss Points / Take Profit Points | Available when the respective strategy is set to Points. |
| Stoploss offset Points | Adds an offset, in points, to the calculated stop loss level — used when computing risk per trade. |
| Take Profit Currency | The take-profit amount in dollars, used when the Fixed Currency Value strategy is selected. |
| Trailing Stop Parameters | |
| Trailing Stop Strategy |
|
| Trailing Stop Trigger | The trigger (in points or ratio) for the Classic Trail Stop method. |
| Trail Amount | The amount (in points or ratio) trailed once the trigger is hit. |
| Super Trend | |
| Visible only when the SuperTrend Entry Filter parameter is enabled. | |
| SuperTrend Mode | ATR-based, or Adaptive (based on candle close/high/low). |
| Period / Multiplier / Moving Avg. Type / Smooth | Standard SuperTrend calculation parameters — period, band multiplier, moving-average type, and smoothing period. |
| Command Buttons | |
| The strategy exposes manual command buttons on the Chart Trader panel — make sure it's displayed on your active chart. | |
| Arm/Disarm Buttons | Manually enable/disable entering long or short trades — useful if you have a directional bias. |
| Close Position Button | Immediately flattens the position on the active instrument without restarting the strategy, which keeps looking for new trades afterward. |
| Increase / Decrease Qty Button | Adjusts the current active position's quantity by ±1 contract. |
| Set Breakeven Button | Moves the open position's stop loss to breakeven, if doing so would improve it. |
Performance Reports
Past results are not a guarantee of future results. All backtesting results are for indicative purposes only.
- Commissions are included, using NinjaTrader's Lifetime license commission schema, for realistic results.
- We follow NinjaTrader's official guide for precise intrabar-granularity backtesting using additional tick-level data series, and only use market orders — never pending orders — in both real-time and backtest modes.
No performance reports have been uploaded for this strategy yet.
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.
Download
You can also download this strategy — and every other automated-trading.ch strategy or indicator — anytime from your centralized Downloads page.
Installation Steps
Frequently Asked Questions
General
Billing
Skeptics
Release Notes
- First release of the strategy