Skip to content
All library documents

Automating Butterfly Harmonic Pattern Trading with Fibonacci Ratios

Article MQL5 articles

Summary

The article describes an MQL5 Expert Advisor that identifies bullish and bearish Butterfly harmonic patterns from five swing points, X, A, B, C, and D. It defines the target geometry using Fibonacci relationships: B near a 78.6% retracement of XA, BC within a stated retracement range, and CD extending beyond X by a stated range. A configurable tolerance controls how closely detected legs must match these ratios.

The EA finds pivots using bars on either side, marks the formation on the chart, and can place trades using calculated entry, stop-loss, and take-profit levels. It also includes pattern locking intended to avoid duplicate trades while a formation develops. The article reports a six-month test on a five-minute chart with 65 trades, describing the pattern as rare and noting that looser tolerance generates more signals. It does not provide the reported graph or performance figures in the supplied text, so profitability and robustness cannot be assessed. The author emphasizes that the method is educational and requires careful testing and risk management.

Key ideas

  • The Butterfly setup uses five alternating swing points to define a potential reversal.
  • The pattern validates its legs against Fibonacci retracement and extension ratios.
  • Pivot width and ratio tolerance are configurable inputs to the Expert Advisor.
  • The program plots confirmed formations and can execute trades using calculated risk and target levels.
  • The reported test notes that signals were uncommon and more tolerance produced more trades.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.