Loading…

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 · MT4 · v1.0 · Free

About Target Approach Glide Manager

Target Approach Glide Manager is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 9 settings, such as Profit target, Glide start percent and Min multiplier. MQL source code included.

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

Settings

SettingDefaultWhat it does
Profit target1000.0Profit target in account currency, from the challenge start balance
Glide start percent60.0Progress %% of target at which the glide begins reducing risk
Min multiplier0.20Risk multiplier floor once progress reaches 100%% of target
Use floating profittrueInclude floating P/L of open positions in progress, not closed profit only
Flatten on target hitfalseClose every open position once progress reaches 100%% of target
Magic filter0Flatten only this magic number on target hit, 0 = all
Slippage points30Slippage tolerance for the target-hit flatten, points
Global var nameTargetApproachGlide_MultiplierGlobal variable other EAs read for the multiplier
Poll seconds5How often progress is recomputed, seconds

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 → Scripts.
  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 script onto a chart to run it once.

Download the PDF guide

Tags: Alerts · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria