Skip to content
All library documents

Trading Gartley, Bat, Butterfly, and Crab Patterns with Pivot Ratios

Article TradingView scripts

Summary

The strategy identifies four XABCD harmonic patterns from confirmed zigzag pivots: Gartley, Bat, Butterfly, and Crab. It measures the AB-to-XA, BC-to-AB, CD-to-BC, and XD-to-XA ratios against pattern-specific Fibonacci ranges, then assigns a score based on how many checks pass. Users can adjust pivot length, ratio tolerance, enabled patterns, and the minimum number of matching ratios.

When a pattern completes at D, the script labels it bullish or bearish based on the last pivot and can enter in the corresponding direction. It places a stop beyond X with an ATR buffer and sets a target using a configurable reward-to-risk multiple; a cooldown can limit entry frequency. The document gives the rules and parameters but no backtest results or performance evidence. Pivot confirmation requires bars on both sides of a swing, so signals arrive after the turning point, and allowing partial ratio matches makes detections less strict. Results may vary with market, timeframe, and settings.

Key ideas

  • The strategy searches the latest five alternating pivots for an XABCD formation.
  • It scores four Fibonacci ratios against separate ranges for each enabled pattern.
  • A pattern can qualify when the selected minimum number of ratio checks pass.
  • Trades follow the expected reversal direction, with an ATR-buffered stop beyond X and a reward-to-risk target.
  • Pivot length, ratio tolerance, trade direction, and cooldown are configurable.

Tags

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