Loading…

Auto Stops For Manual Trades

The terminal's built-in order dialog does not require a stop loss, and it is easy to click Buy or Sell in a hurry and forget one. This EA scans the order pool at a set interval and, for any open trade missing a stop loss or take profit, applies one at a configured pip distance from the entry price. The naive version of this idea reapplies a stop on every scan, which means a trader who deliberately clears a stop - to let a runner ride into a target with no ceiling, say - finds it silently put back a few seconds later. This EA remembers every ticket it has already decided about, whether it added a stop, found one already present, or gave up on a permanent broker error, and never revisits that ticket again. A ticket is only reconsidered if it drops out of the open pool and a new order arrives with the same number, which does not happen in practice. By default it only touches orders with magic number 0, the value the terminal itself uses for manually opened trades, so it will not interfere with another EA's own risk management on the same account. Notes and limitations - A ticket is only ever decided about once. If you manually remove a stop this EA previously added, it stays removed - it will not be reapplied. - Pending orders are left alone; only open positions (market trades) are considered on both platforms. - If a computed stop lands inside the broker's stop or freeze level, that ticket is skipped and retried on the next scan rather than sent and rejected. - If AutoTrading is off when a stop needs applying, the EA logs it and waits for the next scan rather than pretending the position is protected. - This EA never opens or closes a position; it only ever sets SL/TP on trades that already exist. - On an MQL5 netting account, a manual trade that merges into an existing EA position takes on that position's single magic number - see MQL4 VERSUS MQL5 DIFFERENCES for what this means for InpOnlyZeroMagic.

Expert advisor · MT4 · v1.0 · Free

About Auto Stops For Manual Trades

Auto Stops For Manual Trades is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Stop loss pips, Take profit pips and All symbols. MQL source code included.

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

Settings

SettingDefaultWhat it does
Stop loss pips30Stop loss to apply, in pips (0 = do not touch SL)
Take profit pips60Take profit to apply, in pips (0 = do not touch TP)
All symbolsfalseApply on every symbol, not just this chart's symbol
Only zero magictrueOnly touch orders with magic number 0 (manual trades)
Check interval sec5Seconds between scans of the order pool
Max retries5OrderModify attempts before giving up on a ticket
Retry wait ms500Pause between attempts, milliseconds

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: Buy/Sell Arrows · Alerts · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria