Loading…

Fractal Breakout EA

This is a published price-structure idea, offered here for study and as a template to adapt, not a guaranteed edge. A fractal marks a local high or low with two lower highs (or two higher lows) on each side of it, using the built-in iFractals() indicator - no external download required. The trap in this indicator specifically: a fractal is not known the instant the candidate bar forms. iFractals needs the two bars after it to close before the pattern is confirmed, so a fractal that structurally "happened" at bar shift 2 only stops repainting once bar shift 0 itself has closed - one full bar later than it looks from the chart. This EA reads iFractals at shift 2 on every new-bar event, which is the earliest point the value is stable, and only acts on values that changed since the last check. The most recent confirmed up-fractal and down-fractal are kept as a pair of breakout levels. A buy-stop sits above the up-fractal and a sell-stop below the down-fractal, each using the opposite fractal as the stop-loss reference - the logic being that if the level structurally on the other side of the range gets taken out, the breakout thesis for this pair has already failed. Whichever side fills first has the other cancelled immediately, and fractal updates pause entirely while a position from this EA is open. Notes and limitations - Needs both an up-fractal and a down-fractal confirmed at least once before either side arms - a brand new chart with no fractal history yet will show "none" in the Comment until both appear. - One position at a time, tracked by InpMagicNumber. Fractal updates pause while a position is open, so the levels shown afterwards will lag until the position closes and the next new bar re-evaluates them. - If the opposite fractal has already crossed to the wrong side of the entry (a very tight or unusual structure), that side is simply left unarmed rather than sent with an invalid stop. - Requires AutoTrading enabled; on MQL4 that is checked via IsTradeAllowed(), on MQL5 via TERMINAL_TRADE_ALLOWED plus ACCOUNT_TRADE_ALLOWED and ACCOUNT_TRADE_EXPERT. If trading is disabled the EA logs it and does not maintain the pending orders. - A published pattern, not a strategy with a documented statistical edge on any specific symbol - test on your own data before trusting it.

Expert advisor · MT5 · v1.0 · Free

About Fractal Breakout EA

Fractal Breakout EA is an expert advisor (trading robot) for MetaTrader 5 based on Fractals. It places pending buy/sell stop or limit orders, can size trades from your balance and risk percent and trades breakouts. It has 10 settings, such as Buffer pips, Stop loss buffer pips and Reward multiple. MQL source code included.

Files in the download: FractalBreakoutEa.ex5, FractalBreakoutEa.mq5, FractalBreakoutEa.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Buffer pips3Pips added beyond the fractal level before the stop order
Stop loss buffer pips5Extra pips beyond the opposite fractal for the stop-loss
Reward multiple1.5Take-profit as a multiple of the stop distance (0 = no take-profit)
Use risk sizingfalseSize by percent risk instead of a fixed lot
Risk percent1.0Percent of equity risked per trade, when risk sizing is on
Fixed lots0.10Lot size when risk sizing is off, or as a fallback
Magic number20260819Magic number for orders opened by this EA
Slippage pips3Slippage tolerance, in pips
Max retries5Attempts per trade action before giving up
Retry wait ms500Pause between attempts, milliseconds

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Breakout · Fractals · Pending Orders · Risk & Lot Size · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria