Skip to content
All library documents

Fibonacci Retracement Breakout Trading with ZigZag Trend Detection

Article MQL5 code base

Summary

This document describes a MetaTrader Expert Advisor that uses ZigZag swing points to identify a trend and place a Fibonacci retracement grid. Trend direction is inferred from the two latest highs and lows: rising highs and lows indicate an uptrend, falling highs and lows a downtrend, and mixed movement means no trend. The EA then waits for a retracement and enters when price breaks a selected Fibonacci level in the direction opposite the retracement.

Its configurable inputs include ZigZag settings, trade size, stop loss, a Fibonacci extension target, a breakout distance, minimum spacing between swing points, and a pause after closing a trade. The document explains the rule set and parameters, but gives no backtest, performance evidence, or market-specific evaluation. It presents the EA as an illustration of Fibonacci-level trading, so the described rules should not be read as evidence that the approach is profitable.

Key ideas

  • The EA uses the two most recent ZigZag highs and lows to classify the market as trending up, trending down, or trendless.
  • It plots Fibonacci levels only when the swing structure indicates a trend.
  • After a retracement, it enters on a level breakout in the opposite direction of that retracement.
  • Risk and trade behavior depend on configurable stop, target, position size, swing spacing, and cooldown settings.

Tags

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