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
| Setting | Default | What it does |
|---|---|---|
| Breakout buffer pips | 3.0 | Minimum distance a close must clear the level by before it counts as a break |
| Stop loss pips | 0 | Extra stop-loss buffer beyond the opposite day edge, in pips (0 = stop exactly at opposite edge) |
| Take profit pips | 0 | Take profit distance, in pips (0 = none, exit only on reverse signal) |
| Use risk sizing | false | Size by percent risk instead of a fixed lot |
| Risk percent | 1.0 | Percent of equity risked per trade, when risk sizing is on |
| Fixed lots | 0.10 | Lot size when risk sizing is off, or as a fallback |
| Magic number | 20260611 | Magic number for orders opened by this EA |
| Slippage pips | 3 | Slippage tolerance, in pips |
| Max retries | 5 | Attempts per trade action before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Breakout · Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code