Position Manager with Loss Lock and Lot Sizer
- Utilities
-
Kazuma Uezono
MQL5 / MQL4 / Pine Script v6 developer and active trader.
Seller on the MQL5 Market (indicators for MT4/MT5).
Services:
- TradingView Pine Script to MT5/MT4 conversion (bar-by-bar matching, with tester report)
- MT4 to MT5 migration - Version: 1.4
- Activations: 5
This utility EA manages trades on MetaTrader 5 from one panel on the chart. It can add a stop loss and take profit to positions that have none, move the stop to break-even, trail it, close part of a position in two steps, close positions and keep closing new ones when a daily or maximum loss limit you set is reached, react to economic news times, and send orders with a lot size calculated from your risk. The panel title is "Trade Manager".
This is a tool, not a trading strategy. It never decides when to buy or sell and gives no signals. In live trading it opens a position only when you press the order button twice on its panel. Every trade decision and its result is yours.
ALL FUNCTIONS THAT CHANGE OR CLOSE POSITIONS ARE OFF BY DEFAULT
After you attach the EA with the default settings, it does not modify or close anything. The only function on at start is the news filter in "warning only" mode, which shows a message and never trades. You switch each function on with its panel button (or in the inputs) after checking its settings.
MANAGE TAB
- Auto SL / TP for new positions that have none: distance in pips, ATR multiple, or an amount of money in the account currency. Existing SL / TP are never replaced.
- Break-even: after a profit in pips or in R (R = the initial stop distance), the stop moves to the entry price plus an offset.
- Trailing stop, three methods: fixed pips, ATR multiple, or the low / high of the last N closed bars. It starts immediately, after X pips, after X R, or after break-even. The stop only moves in your favour.
- Partial close in two steps: for example 50 % of the initial lot at 1R and 25 % at 2R.
- Seven on / off buttons: SL/TP, BE, Trail, Partial, Daily, Max loss, News.
- Four action buttons, each needs two clicks: Close all, Close buys, Close sells, SL to break-even.
- Which positions are managed: this chart's symbol or all symbols; manual trades only, one magic number, or all trades (manual and all EAs). Positions that were already open when the EA started are not managed unless you choose so.
DAILY LOSS LIMIT / DAILY PROFIT TARGET
- Limit and target in money or in % of the day-start balance or equity. The day's P/L includes closed trades and open positions.
- Day start in server time, UTC, New York time or Central European time (both with daylight saving time), Japan time, or a fixed UTC offset, at any hour and minute.
- When the limit or the target is reached: the positions in scope are closed, pending orders in scope are deleted (option), and positions opened later that day are also closed (option, on by default). The order panel does not send new orders. The lock ends at the next day start.
MAXIMUM LOSS LOCK (for accounts with an overall loss limit)
- Limit in money or in % of the initial capital. Three ways to measure: static (initial capital minus the limit), trailing from the highest balance, or trailing from the highest equity seen while the EA is running.
- Initial capital typed in, or calculated automatically from the account history. Deposits and withdrawals are taken into account.
- The level checked is equity without credit.
- When the floor is reached: positions in scope are closed, pending orders in scope are deleted (option), and every new position in scope is closed. The lock stays, also after a restart, until you change the maximum loss settings.
- Scope of the daily and maximum limits (and of the news closing): the positions managed above, or the whole account (manual trades and all EAs).
NEWS TIMES (uses the economic calendar built into MetaTrader 5)
- High importance only, or medium and high. Window of N minutes before and after the release.
- Currencies taken automatically from the symbols, a manual list, or both.
- Three modes: warning only; close positions opened inside the window; close all positions in scope (held and new). Inside the window the order panel does not send orders in the two closing modes.
ORDER TAB (this chart's symbol)
- Lot calculated from risk: % of balance, % of equity, money, or a fixed lot. Optional maximum lot per order.
- Market orders, or limit / stop orders with an entry line you drag.
- SL in pips, or drag the SL line on the chart. TP as a risk:reward ratio, also with a draggable line. The default SL is ATR x 1 (ATR settings above).
- The panel shows the lot and the money at risk before you send. The order is sent only on the second click, with SL / TP attached.
- An order is not sent when the SL is less than 3 times the current spread, when the SL or entry is inside the broker's stop level, or while a daily / maximum / news lock applies.
OTHER
- Alerts as popup and / or push notification.
- English or Japanese, chosen automatically from the terminal language. The panel can be moved to any corner and collapsed.
- A second copy of the EA in the same terminal waits and does nothing while the first one is running.
- Settings are arranged in 15 groups.
LIMITS YOU SHOULD KNOW BEFORE BUYING
- A loss limit is not a guarantee. The EA closes positions after the limit is reached. Fast moves, price gaps, rejected or delayed orders, lost connection, or a computer or terminal that is off can make the final loss larger than the limit. The EA only works while MetaTrader 5 is running, connected, and Algo Trading is on.
- If you switch off a lock or a function (panel button, inputs, Algo Trading button), it is not enforced.
- The EA cannot stop another EA from opening new trades. If another EA keeps opening positions during a lock, each one is closed again, and each time you pay the spread.
- News: a release is detected up to about 30 seconds late. The event data come from the calendar delivered through your broker's MetaTrader 5 server. The calendar is not available in the Strategy Tester, so the news functions do not work there.
- Positions opened while the terminal was closed are treated as new positions at the next start.
- Commission and swap are not included in the lot calculation, in money-based SL / TP or in R. The daily and maximum limits use the account's real P/L, which includes them.
- Pips: on 3- and 5-digit symbols 1 pip = 10 points; on other symbols 1 pip = 1 point, for example 0.01 on a gold or index quote with 2 digits. This can be changed in the inputs.
- Functions based on R (break-even in R, trailing start in R, partial close) do not work on positions without a stop loss.
- Tested on hedging accounts. Netting accounts have not been tested.
- If the broker's reply comes more than 10 seconds late and the order is filled afterwards, a partial close can be done twice. The position then becomes smaller than planned.
- While the connection is lost, a missing SL is sent again about every 3 seconds until it is set.
- A withdrawal also lowers the base of the maximum loss limit. The automatic initial capital can be wrong when the history contains withdrawals; type in the initial capital if exact values matter.
- The trailing-from-highest-equity mode only knows the equity it has seen while running.
- If the terminal is ended abnormally, some state (for example the progress of partial closes) can be lost.
- Account rules of funded-account programs differ. Check whether this kind of tool is allowed and how the limits are calculated in the rules of your program. The EA does not judge whether you meet any rule.
STRATEGY TESTER
The tester cannot show manual trading. There the EA runs a demonstration: it opens small positions (4 x the minimum lot by default) on a fixed schedule only to show the functions, with all functions switched on. The tester report is not a trading result and says nothing about performance. In live trading the demonstration never runs.
IMPORTANT
- Try the EA on a demo account first and check every setting before you switch a function on in a live account.
- No profit and no limit on losses is promised.
- Support through MQL5 messages, reply within 3 business days: installation, settings and bug reports. Questions about what or when to trade, or about the rules of a particular funded-account program, cannot be answered.
