Target Approach Glide Manager
A challenge with a fixed profit target rewards finishing, not maximising. A trader sitting at 95% of target who keeps sizing at full risk one bad trade from the finish line is taking on asymmetric downside for very little remaining upside - the target does not pay extra for exceeding it, but a blowup can void weeks of work. This EA computes progress toward a declared profit target from the account's realised balance change since attach, optionally adding the floating profit of currently open positions so an unrealised winner already counts. Below a configurable start point the published multiplier stays at 1.0 - full size, no interference. Past that point it glides linearly down to a configurable floor as progress approaches 100% of target, then optionally flattens every open position the moment the target is actually reached, locking in the pass rather than leaving it exposed to the next tick. It never opens a position itself. The multiplier is published through a named global variable (GlobalVariableSet/Get) that any other EA's own lot-sizing function can read before opening its next order - this is a coordination tool for the strategies actually trading, not a strategy in its own right. Notes and limitations Progress is measured from AccountBalance() at attach time forward. Any deposit, withdrawal or credit adjustment during the challenge shifts balance without being a trading result, and this EA has no way to tell the difference - it will misread such a change as progress. Attach it only once per challenge run and do not restart it mid-week unless the balance baseline is meant to reset. MQL4's terminal auto-deletes a GlobalVariableSet() variable after roughly four weeks of no access. This EA re-touches it every InpPollSeconds, so that is not a practical concern while it stays attached and running - only relevant if the chart is closed for an extended stretch mid- challenge. The published multiplier is advisory - it does nothing unless another EA's own sizing code reads it and applies it. This EA cannot force a third-party strategy to respect it.
Expert advisor · MT5 · v1.0 · Free
About Target Approach Glide Manager
Target Approach Glide Manager is an expert advisor (trading robot) for MetaTrader 5. It increases the lot size after a losing trade (martingale) and can size trades from your balance and risk percent. It has 9 settings, such as Profit target, Glide start percent and Min multiplier. MQL source code included.
Files in the download: TargetApproachGlide.ex5, TargetApproachGlide.mq5, TargetApproachGlide.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 |
|---|---|---|
| Profit target | 1000.0 | Profit target in account currency, from the challenge start balance |
| Glide start percent | 60.0 | Progress % of target at which the glide begins reducing risk |
| Min multiplier | 0.20 | Risk multiplier floor once progress reaches 100% of target |
| Use floating profit | true | Include floating P/L of open positions in progress, not closed profit only |
| Flatten on target hit | false | Close every open position once progress reaches 100% of target |
| Magic filter | 0 | Flatten only this magic number on target hit, 0 = all |
| Slippage points | 30 | Slippage tolerance for the target-hit flatten, points |
| Global var name | TargetApproachGlide_Multiplier | Global variable other EAs read for the multiplier |
| Poll seconds | 5 | How often progress is recomputed, seconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 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: Martingale · Risk & Lot Size · MT5 Expert Advisor · MQL5 Source Code