Loading…

News Straddle EA

A straddle is the standard way to trade a scheduled release without guessing direction: place pending stops on both sides of price, let the move itself pick which one fills, and cancel the loser the instant that happens. The one-cancels-other mechanics here match a plain OCO manager - "resolved" covers a fill, a manual deletion, or an expiry, not only a fill, so neither leg is ever left orphaned on the book. What a news straddle needs beyond that is a schedule and an honest way to give up. InpDeployMinutesBefore controls how long before the release the legs go out - late enough that the distance doesn't need to be absurd, early enough to be resting before the number prints. InpRemoveMinutesAfter is the part a plain OCO manager doesn't have: if neither leg has triggered by that many minutes after the release, both are pulled. A straddle that never got hit was a dud for this event, not a trade worth leaving live to be caught by whatever happens next. Both legs are sent from the live bid/ask at deployment time rather than a price captured earlier, so the distance the trader configured is measured from where the market actually is a few minutes before the print, not from a stale reference point. Notes and limitations - All scheduling and monitoring run on a timer (InpScanIntervalSec), not on price ticks, so the straddle deploys and resolves on wall-clock time even through a thin pre-news market. - Fills during a genuine spike can land well past the requested price - this EA does not attempt to limit slippage beyond the broker's own execution, and a wide, fast move can fill both legs in rapid succession before the cancel reaches the server. Confirm behaviour on a demo account before running live. - Verify the configured release time against your broker's actual server time zone, which does not always match the exchange or your local time. - Requires AutoTrading enabled and IsTradeAllowed() true (MQL4) or the equivalent terminal/account/expert checks (MQL5); if trading is disabled at deployment time the straddle for that window is skipped entirely, not deployed late. - On a netting MQL5 account, this EA will not deploy while a foreign-magic position already sits on the chart symbol - see the differences section above.

Expert advisor · MT4 · v1.0 · Free

About News Straddle EA

News Straddle EA is an expert advisor (trading robot) for MetaTrader 4. It places pending buy/sell stop or limit orders and has a news filter. It has 13 settings, such as News hour, News minute and Deploy minutes before. MQL source code included.

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

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

Settings

SettingDefaultWhat it does
News hour12Server hour of the scheduled release (0-23)
News minute30Server minute of the scheduled release (0-59)
Deploy minutes before10Minutes before the release to deploy the straddle
Remove minutes after20Minutes after the release to cancel an untriggered straddle
Distance pips15Distance of each leg from price at deployment, in pips
Stop loss pips30Stop-loss per leg, in pips from that leg's own entry (0 = none)
Take profit pips45Take-profit per leg, in pips from that leg's own entry (0 = none)
Lots0.01Lot size for each leg
Repeat dailytrueRedeploy for the same time window on the next day
Magic number20260816Magic number for both legs of this straddle
Max retries5Attempts per order action before giving up
Retry wait ms500Pause between attempts, milliseconds
Scan interval sec5Seconds between schedule/monitor checks

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: News Trading · Pending Orders · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria