Watch how to download trading robots for free
Find us on Facebook!
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

Break-even and Trailing Stop Manager - expert for MetaTrader 5

Views:
75
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Attach it to a chart and it manages the stop loss of existing positions: your manual trades or trades opened by any other EA.


Break-even:
- When profit reaches X points, SL moves to entry plus Y points of locked profit.

Trailing stop:
- Fixed distance in points, or ATR multiple (ATR period and timeframe selectable; ATR of the last closed bar is used, so the value does not jump within the bar).
- Starts only after a chosen profit in points.

Safety rules:
- SL only moves forward, never back, and only by at least the "minimum SL step" (fewer modification requests to the broker).
- Respects the broker's stop level and freeze level.
- Does not send requests while the symbol's trading session is closed (daily break, weekend).
- If the broker rejects a modification, that ticket is paused for a set number of seconds instead of flooding the log and the server.
- The existing take profit is kept.

Filters:
- Chart symbol only, or all symbols.
- Magic number: -1 = all, 0 = manual trades only, or a specific EA.

Tested in the Strategy Tester on XAUUSD and EURUSD (2 months, M5): thousands of stop loss modifications, none moved backwards.


Breakeven Trailing Manager

Trade Cost Meter Trade Cost Meter

Shows the real cost of a trade on the current symbol (spread, commission, swap) and which share of your risk (R) it takes on every timeframe from M1 to D1.

LotFromRisk: position size from risk, stop and commission LotFromRisk: position size from risk, stop and commission

An include file for calculating the size of a position to be opened. It turns a risk figure (percent of the balance, percent of the equity or money), a stop and a commission per lot into a lot size whose loss at the stop never goes over that risk. The lot is always rounded down to the volume step and a risk below the minimum volume returns 0 lots with a reason.

Equity Guard Equity Guard

Closes all positions, deletes pending orders and blocks new trades when the daily loss, drawdown-from-peak or daily profit target is reached. Works with manual trading and any other EA. State survives terminal restart.

XAUUSD Hang Seng Split: a free gold EA that reads the Hong Kong market XAUUSD Hang Seng Split: a free gold EA that reads the Hong Kong market

This is a free, execution only EA for gold on M15. It compares gold with the Hang Seng (HK50). When gold has split far away from it, the EA trades in the direction of that split, but only while gold itself is calm and hasn't already made the move.