Loading…

Previous Day Breakout EA

The level is read from the D1 timeframe, regardless of the chart the EA is actually running on, so a break is judged against the true daily bar rather than an approximation stitched together from intraday bars. A close has to clear the level by InpBreakoutBufferPips, not merely touch it, before a trade fires. A level sitting exactly at yesterday's high or low gets probed constantly by price noise right at that price; requiring a small margin past it is what turns this from "trade every marginal poke of the line" into "trade a break that meant something." The stop sits at the opposite day's edge, so a position that survives the breakout still has a defined risk against yesterday's whole range. Position sizing can run as a fixed lot or, with InpUseRiskSizing on, as a percentage of equity risked to that stop distance, using tick value and tick size rather than a hardcoded contract size so it prices correctly on gold, indices and JPY crosses as well as plain FX pairs. Notes and limitations - Exactly one trade per calendar day (server date) - this EA does not re-arm intraday once a trade has fired or been skipped. - If the opposite-day stop would land inside the broker's minimum stop distance, that day is skipped rather than sending an invalid order. - Only one position at a time, tracked by InpMagicNumber. On a netting account that means one merged position per symbol; the magic filter is effectively all-or-nothing per symbol rather than per individual order. It will not manage or interfere with trades opened manually or by another EA (or, on MQL5 netting, another magic number). - Requires at least two completed D1 bars of history on the symbol before it will evaluate a signal. - Requires AutoTrading enabled and trading permitted at the terminal, account and expert level; if trading is disabled the EA logs it and skips the entry.

Expert advisor · MT4 · v1.0 · Free

About Previous Day Breakout EA

Previous Day Breakout EA is an expert advisor (trading robot) for MetaTrader 4. It can size trades from your balance and risk percent and trades breakouts. It has 10 settings, such as Breakout buffer pips, Stop loss pips and Take profit pips. MQL source code included.

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

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

Settings

SettingDefaultWhat it does
Breakout buffer pips3.0Minimum distance a close must clear the level by before it counts as a break
Stop loss pips0Extra stop-loss buffer beyond the opposite day edge, in pips (0 = stop exactly at opposite edge)
Take profit pips0Take profit distance, in pips (0 = none, exit only on reverse signal)
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 number20260611Magic 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 · Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria