Loading…

Fractal Shelf Break System

Most published "swing breakout" EAs treat every fractal swing point as its own level, which scatters a chart with near-duplicate lines that are really the same shelf seen twice. This EA rebuilds the same equal-extreme clustering idea used elsewhere in this catalogue's indicators directly inside the trading logic: on every closed bar it rescans the recent history for confirmed fractal swings (a high or low with InpSwingSpan bars clear on each side), and any swing that lands within InpClusterTolerancePips of an existing shelf is merged into it with a tick-volume-weighted average price, rather than recorded as a new level. A shelf only becomes tradeable once it has accumulated InpMinTouches separate confirmed swings - two touches during a real session carry more weight than one, and a single fractal spike proves nothing on its own. Entry requires a CLOSED bar's close to clear the nearest qualified shelf by InpBreakBufferPips, so an intrabar stop-run wick through a thin level does not trigger a trade the market itself did not confirm. The initial stop sits just beyond the shelf's own far edge - a false break back through the shelf invalidates the trade at the same level that defined it. Notes and limitations - The shelf table is rebuilt from scratch each new bar rather than maintained incrementally - simple and correct, but scanning a very large InpLookbackBars on a low timeframe adds per-bar CPU cost. - A shelf is retired ("broken") once a closed bar's close passes through it by InpBreakBufferPips; it stops counting toward new breakout signals but is not deleted from the table. - Only one position at a time; no pyramiding across multiple shelves. - Lot sizing uses MODE_TICKVALUE/MODE_TICKSIZE, not a hardcoded contract size, so it is correct on gold, indices and JPY crosses as well as plain FX pairs. - Like any breakout system, this can produce a string of small losses in a choppy market where shelves keep forming and false-breaking - this is inherent to the method, not a configuration mistake.

Expert advisor · MT4 · v1.0 · Free

About Fractal Shelf Break System

Fractal Shelf Break System is an expert advisor (trading robot) for MetaTrader 4. It can size trades from your balance and risk percent and trades breakouts. It has 15 settings, such as Swing span, Cluster tolerance pips and Min touches. MQL source code included.

Files in the download: FractalShelfBreak.ex4, FractalShelfBreak.mq4, FractalShelfBreak.txt.

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

Settings

SettingDefaultWhat it does
Swing span3Bars required clear on each side to confirm a fractal swing
Cluster tolerance pips8.0How close two swings must be, in pips, to share one shelf
Min touches2Minimum confirmed swings before a shelf is tradeable
Max shelves per side20Maximum shelves tracked per side (oldest dropped first)
Lookback bars300Closed bars scanned for fractal swings on each new bar
Break buffer pips2.0Close must clear the shelf by this many extra pips
Use risk sizingtrueSize by percent risk to the stop 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 sizing fallback
Stop buffer pips5.0Extra pips beyond the shelf's far edge used for the stop
Reward risk ratio2.0Take-profit distance as a multiple of the stop distance
Magic number43722Magic 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 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 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 · Channels & Envelopes · Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria