News Graduated Trade Manager
This is a trade manager, not a signal generator - it opens no positions, only manages ones already open. MQL4 has no live economic calendar API, so this EA reads a plain CSV file the trader (or an external script, cron job, or manual edit) places into MQL4\Files\ (or MQL5\Files\ on the native MQL5 build) - the exact format is documented below and repeated as a comment block at the top of the source file. The risk a scheduled release poses to an open position is not binary - it rises as the event gets closer, and an all-or-nothing "flatten everything N minutes before news" approach either acts too early (giving up a position that would have been fine) or too late (still holding full size moments before the print). This EA instead applies three graduated stages as the clock counts down to the nearest qualifying event for the chart's symbol: Stage 1 (InpStage1Minutes out) - closes InpStage1PartialPercent of the ORIGINAL position size, reducing exposure while leaving the trade's thesis intact. Stage 2 (InpStage2Minutes out) - moves the stop to breakeven plus a small buffer, so the remaining size cannot turn into a loss purely from the event itself. Stage 3 (InpStage3Minutes out) - closes the position outright. Each stage only fires once per event and only moves forward (a position already at stage 2 is never re-evaluated back down to stage 1); if no qualifying event remains within InpStage1Minutes, a position's stage tracking resets so it is protected again ahead of the next event. CALENDAR FILE FORMAT (MQL4\Files\ (or MQL5\Files\ on the native MQL5 build)<InpCalendarFileName>, plain CSV, one event per line): YYYY.MM.DD HH:MM,CCY,IMPACT,Title 2026.08.20 12:30,USD,3,Non-Farm Payrolls 2026.08.21 09:00,ALL,2,Fed Chair Speech CCY is a 3-letter currency code (matched against the chart symbol's base and quote currency, taken as the first and second three-letter groups of the symbol name), or the literal ALL for an event treated as relevant to every symbol regardless of currency. IMPACT is an integer from 1 (low) to 3 (high); only events at or above InpMinImpact are acted on. Title is free text, read but not otherwise used by the EA. Malformed lines are skipped and counted in the Experts log rather than aborting the whole file. Notes and limitations - This EA never opens a position, only manages ones already open, and its only source of event timing is the CSV file described above - there is no live news feed, so the calendar's accuracy and freshness are entirely the trader's responsibility. - Currency matching is a plain three-letter split of the symbol name (e.g. EURUSD -> EUR, USD); a broker suffix on the symbol name (EURUSDm, EURUSD.a) does not affect the first six characters used for matching, but a genuinely non-standard symbol naming scheme may not match correctly and should be checked against the Comment panel's loaded-event count. - Per-ticket stage progress lives in memory only and does not survive an EA restart - a position already partway through its graduated stages when the EA is reattached starts fresh against whatever event is then nearest. - If InpStage1PartialPercent computes a slice below the broker's minimum lot size, stage 1 is marked as done without actually reducing size, so stages 2 and 3 still fire on schedule. - The stage 1 partial and stage 3 close are market actions and carry ordinary slippage; during genuinely high-impact news the actual fill can differ meaningfully from the price seen when the order was sent.
Expert advisor · MT4 · v1.0 · Free
About News Graduated Trade Manager
News Graduated Trade Manager is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 12 settings, such as Calendar file name, Min impact and Reload every minutes. MQL source code included.
Files in the download: NewsGraduatedTradeManager.ex4, NewsGraduatedTradeManager.mq4, NewsGraduatedTradeManager.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Calendar file name | NewsCalendar.csv | File in MQL4\Files\ holding the calendar, see header for format |
| Min impact | 2 | Minimum IMPACT value (1-3) an event needs to be acted on |
| Reload every minutes | 60 | Re-read the calendar file this often, in case it was updated |
| Stage1 minutes | 60 | Minutes-to-event at which stage 1 (partial close) triggers |
| Stage1 partial percent | 30.0 | Percent of the ORIGINAL position closed at stage 1 |
| Stage2 minutes | 20 | Minutes-to-event at which stage 2 (move stop to breakeven) triggers |
| Breakeven buffer pips | 1.0 | Buffer added past open price for the stage 2 breakeven stop |
| Stage3 minutes | 5 | Minutes-to-event at which stage 3 (full close) triggers |
| Magic number | -1 | Magic number to manage; -1 manages every position on this symbol |
| Max retries | 5 | Order action attempts before giving up |
| Retry wait ms | 500 | Pause between retry attempts, milliseconds |
| Slippage pips | 3 | Slippage tolerance for market actions, in pips |
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 → Scripts.
- 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 script onto a chart to run it once.
Tags: Buy/Sell Arrows · News Trading · Trailing Stop & Break-even · Alerts · MT4 Expert Advisor · MQL4 Source Code