Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Experts

Trailing Stop and Break-Even Manager (points or ATR) - expert for MetaTrader 5

Gilberto Cardona Velez
Gilberto Cardona Velez
  • MQL4/MQL5 developer - Expert Advisors, backtests and strategy conversion at  Laboratorio de Estrategias
  • Colombia
  • 406
Laboratorio de Estrategias - we turn trading ideas into tested, automated systems, with honest, data-driven verdicts.
Services:
- Expert Advisors for MT4 / MT5 built to your rules (entries, exits, risk, time filters), with a written risk audit
Views:
35
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

This utility manages the stop loss of positions that are already open, whether you opened them by hand or with another Expert Advisor. It never opens or closes trades by itself: it only moves the stop loss, and only in your favour.


What it does

  1. Break-even: when a position reaches the profit you choose (in points), the stop moves to the entry price plus a small locked profit.
  2. Trailing stop: after a second profit level, the stop follows the price at a fixed distance in points or at a multiple of ATR.
  3. The stop is never moved backwards, it only changes when it improves by at least the minimum step, and it respects the broker's minimum stop distance.

Inputs

  • Break-even trigger and locked profit (points; trigger 0 = off)
  • Trailing mode: off, fixed points or ATR multiple
  • Trailing start, distance, ATR multiple, ATR period and timeframe
  • Minimum step to move the stop
  • Positions to manage: this chart's symbol or all symbols
  • Magic number filter (-1 = any, 0 = manual trades only)
  • Status panel on the chart

How to use it

Attach it to any chart and enable Algo Trading. It checks the positions every second and on every tick. If the broker rejects a change (for example, market closed), it waits 60 seconds before trying again. Test it on a demo account first.

Not financial advice. Past results do not guarantee future results.

Close All at Total Profit or Loss (money) Close All at Total Profit or Loss (money)

Utility EA that closes all positions (and optionally deletes pending orders) when the total floating profit reaches your target or the total floating loss reaches your limit, in account currency. It never opens trades.

News Straddle EA Economic Calendar News Straddle EA Economic Calendar

News trading EA for Gold (XAUUSD) and forex: places a Buy Stop and a Sell Stop seconds before each release of the MT5 economic calendar, one cancels the other, stop loss, take profit and trailing in points. Open source code.

Trade-Request Matrix: Regression Testing Invalid Stops, Volume and Close Errors with OrderCheck() Trade-Request Matrix: Regression Testing Invalid Stops, Volume and Close Errors with OrderCheck()

Part 4 of the regression-testing series. An Expert Advisor that builds a fixed matrix of 20 valid and invalid trade requests (stops at and inside the stops level, wrong-side stops, volume outside the symbol rules, oversized and unknown closes, unchanged and wrong-side modifications), checks each one with OrderCheck() without sending anything, and reports PASS, FAIL or INCONCLUSIVE per row with a digest you can compare between runs.

MACD Signals MACD Signals

Indicator edition for new platform.