The Butterfly [theUltimator5]This is a technical analysis tool designed to automatically detect and visualize Butterfly harmonic patterns based on recent market pivot structures. This indicator uses a unique plotting and detection algorithm to find and display valid Butterfly patterns on the chart.
The indicator works in real-time and historically by identifying major swing highs and lows (pivots) based on a user-defined ZigZag length. It then evaluates whether the most recent price structure conforms to the ideal proportions of a bullish or bearish Butterfly pattern. If the ratios between price legs XA, AB, BC, and projected CD meet defined tolerances, the pattern is plotted on the chart along with a projected D point for potential reversal.
Key Features:
Automatic Pivot Detection: The script analyzes recent price action to construct a ZigZag pattern, identifying swing points as potential X, A, B, and C coordinates.
Butterfly Pattern Validation: The pattern is validated against traditional Fibonacci ratios:
--AB should be approximately 78.6% of XA.
--BC must lie between 38.2% and 88.6% of AB.
--CD is projected as a multiple of BC, with user control over the ratio (e.g., 1.618–2.24).
Bullish and Bearish Recognition: The pattern logic detects both bullish and bearish Butterflies, automatically adjusting plotting direction and color themes.
Custom Ratio Tolerance: Users can define how strictly the AB/XA and BC/AB legs must adhere to ideal ratios, using a percentage-based tolerance slider.
Fallback Detection Logic: If a new pattern is not identified in recent bars, the script performs a backward search on the last four pivots to find the most recent valid pattern.
Force Mode: A toggle allows users to force the drawing of a Butterfly pattern on the most recent pivot structure, regardless of whether the ideal Fibonacci rules are satisfied.
Dynamic Visualization:
--Clear labeling of X, A, B, C, and D points.
--Colored connecting lines and filled triangles to visualize structure.
--Optional table displaying key Fibonacci ratios and how close each leg is to ideal values.
Inputs:
Length: Controls the sensitivity of the ZigZag pivots. Smaller values result in more frequent pivots.
Tolerance (%): Adjustable threshold for acceptable deviation in AB/XA and BC/AB ratios.
CD Length Multiplier: Projects point D by multiplying the BC leg using a value between 1.618 and 2.24.
Force New Pattern: Overrides validation checks to display a Butterfly structure on recent pivots regardless of ratio accuracy.
Show Table: Enables a table showing calculated ratios and deviations from the ideal.
Butterfly
Harmonic Pattern Table Inputs█ OVERVIEW
This indicator was intended as educational purpose only based on Harmonic Pattern Table (Source Code) .
Some user have different ratios in mind, thus I add input to allow user to change those ratios.
█ CREDITS
Scott M Carney, Trading Volume 3: Reaction vs. Reversal
█ CREDITS
1. List Harmonic Patterns.
2. Font size small for mobile app and font size normal for desktop.
3. Font color does automatically change follow dark / light chart theme.
4. Inputs to change ratio values.
█ USAGE / EXAMPLES
Harmonic Pattern Table UDT█ OVERVIEW
This table indicator was intended as helper / reference for using XABCD Pattern drawing tool.
The values shown in table was based on Harmonic Trading Volume 3: Reaction vs. Reversal written by Scott M Carney.
Code upgrade from Harmonic Pattern Table (Source Code) and based on latest User-Defined Type (UDT) .
As a result, code appeared more cleaner.
█ FEATURES
1. List Harmonic Patterns.
2. Font size small for mobile app and font size normal for desktop.
3. Options to show Animal name in text, emoji or both.
█ USAGE
Similar to Harmonic Pattern Table (Source Code).
█ CREDITS
Scott M Carney, Trading Volume 3: Reaction vs. Reversal
Strategy Myth-Busting #20 - HalfTrend+HullButterfly - [MYN]#20 on the Myth-Busting bench, we are automating the " I Found Super Easy 1 Minute Scalping System And Backtest It 100 Times " strategy from " Jessy Trading " who claims 30.58% net profit over 100 trades in a couple of weeks with a 51% win rate and profit factor of 1.56 on EURUSD .
This one surprised us quite a bit. Despite the title of this strategy indicating this is on the 1 min timeframe, the author demonstrates the backtesting manually on the 5 minute timeframe. Given the simplicity of this strategy only incorporating a couple of indicators, it's robustness being able to be profitable in both low and high timeframes and on multiple symbols was quite refreshing.
The 3 settings which we need to pay most attention to here is the Hull Butterfly length, HalfTrend amplitude and the Max Number Of Bars Between Hull and HalfTrend Trigger. Depending on the timeframe and symbol, these settings greatly impact the performance outcomes of the strategy. I've listed a couple of these below.
And as always, If you know of or have a strategy you want to see myth-busted or just have an idea for one, please feel free to message me.
This strategy uses a combination of 3 open-source public indicators:
Hull Butterfly Oscillator by LuxAlgo
HalfTrend by Everget
Trading Rules
5 min candles but higher / lower candles work too.
Stop loss at swing high/low
Take Profit 1.5x the risk
Long
Hull Butterfly gives us green column, Wait for HalfTrend to present an up arrow and enter trade.
Short
Hull Butterfly gives us a red column , Wait for HalfTrend to present a down arrow and enter trade.
Alternative Trading Settings for different time frames
1 Minute Timeframe
Move the Hull Butterfly length from the default 11 to 9
Move the HalfTrend Amplitude from the default 2 to 1
Enabling ADX Filter with a 25 threshold
2 Hour Timeframe
Move the HalfTrend Amplitude from the default 2 to 1
Laddered Take Profits from 14.5% to 19% with an 8% SL