AutoPilot FX EA
An ATR-based breakout straddle bot for MetaTrader 5. It brackets price with a Buy Stop and a Sell Stop sized from current volatility, follows whichever way the market breaks, cancels the other side, and re-arms once the trade closes — with an adjustable daily loss limit and built-in safety warnings.
What it does
Stop-and-reverse breakout logic, driven by volatility rather than a fixed distance.
Volatility-sized straddle
Distance from price for both pending orders is ATR × multiplier, so the bracket widens in fast markets and tightens in quiet ones.
Breakout direction
Whichever stop order triggers first rides the breakout. Each entry carries a tight, fixed Stop Loss and Take Profit in points.
OCO behaviour
When one side fills, the opposite pending order is cancelled automatically. Only one straddle (two pending orders) is ever active — no grid, no martingale.
Auto re-arm & re-center
After a trade closes on SL or TP, a fresh straddle is placed around the new price. If price drifts off without triggering, the straddle re-centers.
Key features
Safety and transparency are built in, not bolted on.
OCO straddle engine
Buy Stop above, Sell Stop below; first fill wins, the other order is pulled.
Adjustable daily loss limit
Halts trading for the rest of the day once losses hit a cap — a percentage of the day-start balance or a fixed amount. Optionally closes any open position when the limit is reached.
Spread filter
Skips placing new orders when the spread is wider than your threshold, to avoid entering during news spikes.
Input sanity-check warnings
On load, the EA checks your settings against recommended safe ranges and raises an Alert plus a detailed log explanation for anything outside them. It still runs with your values — the warning is informational.
On-chart dashboard
Live status panel showing current state, today's P/L, and whether the daily limit has been hit.
Single self-contained file
One .mq5, no dependencies, no DLLs. Compile in MetaEditor and run.
Installation
About two minutes in MetaTrader 5.
- Download
AutoPilotFX_EA.mq5from the button above. - In MetaTrader 5, open File → Open Data Folder.
- Copy the file into
MQL5/Experts/. - Back in MT5, right-click Expert Advisors in the Navigator and choose Refresh (or press F7 in MetaEditor to compile).
- Drag AutoPilotFX_EA onto a chart (tested on EURUSD) and tick Allow Algo Trading.
- Review the Inputs tab, adjust to your account and risk, and confirm.
Key inputs
Full list is in the EA's Inputs tab; these are the ones that matter most.
| Input | Default | Notes |
|---|---|---|
InpATRPeriod | 14 | ATR period |
InpATRTimeframe | M15 | Timeframe used for the ATR reading |
InpATRMultiplier | 1.0 | Distance from price = ATR × this |
InpSLPoints | 80 | Stop loss (points) |
InpTPPoints | 120 | Take profit (points) |
InpLotSize | 0.01 | Lot size |
InpMagicNumber | 260826 | Unique EA identifier |
InpMaxSpreadPoints | 200 | Max allowed spread (points) |
InpUseDailyLossLimit | true | Enable / disable the daily cap |
InpLimitIsPercent | true | % of day-start balance vs fixed amount |
InpDailyLossPercent | 3.0 | Recommended max: 5% |
InpDailyLossAmount | 20.0 | Used only if InpLimitIsPercent = false |
InpCloseOpenOnLimitHit | true | Close open position when the limit hits |
Disclaimer — read before use
- Use a demo account first. Run the EA on a demo account until you understand its behaviour in your market and on your broker's conditions.
- No guarantee of profit. Straddle bots whip-saw and lose repeatedly in ranging or choppy markets, and only profit on genuine breakouts. Past or simulated results do not predict future results.
- The daily loss limit is a safety brake, not a promise. It caps losses within a single session — it does not make the strategy profitable.
- Not financial advice. This software is provided for educational and informational purposes only. Nothing here is a recommendation to trade any instrument. Trading forex and CFDs carries a high risk of loss and is not suitable for everyone. You are solely responsible for any use of this EA and any resulting losses.
- No warranty. The software is provided “as is”, without warranty of any kind.