Position Manager with Loss Lock and Lot Sizer MT4

  • Utilities
  • Kazuma Uezono
    Kazuma Uezono
    • MQL5 / MQL4 / Pine Script Developer at  KuHero
    • Japan
    • 5504
    5 (1)
    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.8
  • Updated: 17 November 2026
  • Activations: 5
Position manager for MetaTrader 4. You open your trades; this EA looks after them from one panel on the chart and applies the rules you set: a stop loss and take profit for trades that have none, break-even, trailing stop, two-step partial close, a daily loss limit or profit target, and a maximum loss lock for accounts with an overall loss rule. An order panel sizes the lot from your risk before you send. The panel on the chart is titled "Trade Manager".

It is a management tool. It does not look for entries, gives no signals and never trades by itself on a live account: a position is opened only when you click the order button on its panel twice. You make every trading decision and you are responsible for the result.

READ FIRST: HOW THE MT4 VERSION DIFFERS
- No news filter. MetaTrader 4 has no built-in economic calendar, so this version cannot pause or close trades around news releases.
- A partial close creates a new ticket. When part of a position is closed, MT4 gives the rest a new ticket with the comment "from #<old ticket>". The EA reads this comment and carries the state (initial stop, R, partial-close progress) over to the new ticket. If your broker does not use this comment format, the state is lost after the first partial close: the second partial close and the functions based on R do not continue on the remaining position.
- Accounts that reject SL / TP on market orders (error 130): the panel then sends the market order without stops and adds the panel's SL / TP right after the position opens. For a short moment the position has no stop.
- History depends on the "Account History" tab. MT4 lets an EA read only the period selected in that tab. The automatic initial capital and the day's closed P/L are calculated from that period. Select "All History", or type the initial capital in the inputs.
- Server time is estimated from your computer clock. Keep the clock correct (automatic time sync); otherwise the day start of the daily limit can shift.
- Panel items that change only with time are refreshed on the next price tick, so in a quiet market they can lag a little.
- Orders and closes are sent one at a time and the EA waits for each reply, so "Close all" with many positions can take a few seconds.

NOTHING CHANGES UNTIL YOU SWITCH IT ON
With the default inputs the EA does not modify, close or open anything. Each function has a button on the panel (and an input for its state at start). Check the settings, then switch on only what you need. Try everything on a demo account before using a live account.

MANAGING OPEN TRADES
- Stops for trades without them: if a new trade has no SL or TP, the EA adds one at a distance in pips, as an ATR multiple, or as an amount of account currency. An SL or TP that already exists is left as it is.
- Break-even: once the trade is in profit by a number of pips or by a multiple of R (R = initial stop distance), the stop goes to entry plus an offset.
- Trailing: fixed pips, ATR multiple, or the low / high of the last N closed bars. It starts at once, after X pips, after X R, or after break-even. The stop is never moved against you.
- Partial close: up to two steps, each at a profit in R and a percentage of the initial lot (default step 1: 50 % at 1R).
- Six ON / OFF buttons: SL/TP, BE, Trail, Partial, Daily, Max loss.
- Four action buttons, each confirmed by a second click: Close all, Close buys, Close sells, SL to break-even.
- Target trades: this chart's symbol or every symbol; manual trades, one magic number, or every trade on the account. Trades already open when you attach the EA are left alone unless you select them.

DAILY LIMIT AND DAILY TARGET
- Set in account currency or as a percentage of the balance or equity at the start of the day. Closed and open P/L both count.
- The day can start on server time, UTC, New York or Central European time (daylight saving included), Japan time or a fixed UTC offset, at the hour and minute you choose.
- When the limit or target is hit, trades in scope are closed, their pending orders can be deleted, and by default any trade opened later that day is closed as well. The order panel stays blocked until the next day start.
- The daily lock is released before the next day start if you change a daily setting (limit, target, time zone, hour, minute or basis), the target trades, the scope of closing, or the chart symbol when only this chart's symbol is managed.

MAXIMUM LOSS LOCK
- For accounts with an overall loss rule. Limit in account currency ("Money (account currency)") or as a share of the initial capital ("Percent of initial capital").
- Up to version 1.02 that percent choice was shown as "Percent of the day-start basis", although the floor was always based on the initial capital. Version 1.07 fixes only the label, so .set files you saved earlier keep working.
- The floor is measured in one of three ways: static (initial capital minus limit), trailing the highest balance, or trailing the highest equity seen while the EA runs.
- Initial capital: typed in, or worked out from the history (deposits and withdrawals included; see the "Account History" point above). Equity without credit is compared with the floor.
- At the floor, trades in scope are closed, pending orders can be deleted, and new trades in scope keep being closed. The lock survives a restart and is lifted only when you change the maximum loss settings.
- What the limits close: the target trades above, or everything on the account (manual trades and all EAs).

ORDER PANEL (this chart's symbol)
- Lot from risk: % of balance, % of equity, an amount of money, or a fixed lot, with an optional lot cap.
- Market, limit or stop orders. Drag the entry line for pending orders and the SL / TP lines to set distances; TP is set as a risk:reward ratio. Default SL = ATR x 1.
- The lot and the money at risk are shown before sending. The order goes out on the second click.
- No order is sent when the SL is under 3 x the current spread, when the SL or entry is inside the broker's stop level, or while a daily or maximum loss lock is active.
- If the broker does not answer an order, the EA searches the order list for up to 15 seconds and does not accept the order button during that time and just after. A fill can still arrive after the 15 seconds: look at the "Trade" tab before clicking again.

ONE COPY PER TARGET
- Please keep to one copy for each target (overlapping symbol and magic number settings). If two copies on the same account in the same terminal still cover the same trades, one manages and the other stands by: it does nothing and sends no alerts or notifications. Copies in two different terminals do not know about each other.
- The manager is the copy that was put on the chart first, also after a timeframe or input change and after a terminal restart. A copy brought back by a template or a profile is treated as the newer one.
- If the managing copy may not trade ("Allow live trading" unticked in its own settings), the other copy takes over. Tick the box again and the first copy manages again; for up to about 2 seconds during that switch both copies can act.
- Just after loading (attaching, terminal start, template or profile, but not a timeframe or input change) the EA spends about 3 seconds looking for other copies and manages nothing. The panel reads "Starting: checking for other Trade Manager copies". A daily or maximum loss lock reached in those seconds still closes the trades once the check is over, but the alert for it may not be shown.

ALSO GOOD TO KNOW
- English or Japanese, following the terminal language. Popup and push alerts. The panel can sit in any corner and can be collapsed. Inputs are arranged under 14 headings.
- MT4 version: if the Windows "Language for non-Unicode programs" cannot display Japanese, the panel and its messages switch to English automatically, even when Japanese is selected (an MT4 limitation).
- A limit does not guarantee the size of a loss. The EA acts after the level is crossed; gaps, fast markets, requotes or rejected orders, a lost connection or a closed terminal can make the loss larger. It works only while MT4 is running and connected and AutoTrading is on.
- Anything you switch off (panel button, input, AutoTrading) is not enforced.
- Another EA can still open trades; during a lock they are closed again each time, and each time costs the spread.
- Commission and swap are left out of the lot size, money-based SL / TP and R; the limits use the real account P/L, which includes them.
- Pips: 1 pip = 10 points on 3- and 5-digit symbols, otherwise 1 point (for example 0.01 on a 2-digit gold or index price). Adjustable in the inputs.
- Functions based on R need a stop loss on the trade.
- If the broker replies more than 10 seconds late and the order is filled afterwards, a partial close can be done twice, leaving a smaller position than planned.
- While disconnected, a missing SL is resent about every 3 seconds until it is set.
- Withdrawals also lower the maximum loss base; the automatic initial capital can be wrong when the history contains withdrawals.
- The trailing-equity mode knows only the equity seen while running. After an abnormal shutdown some state (such as partial-close progress) can be lost. Trades opened while the terminal was closed are treated as new trades at the next start.
- Funded-account programs have their own rules. Check whether this kind of tool is allowed and how their limits are calculated; the EA does not check whether you meet any rule.

IN THE STRATEGY TESTER
Manual trading cannot be shown in the tester, so there the EA opens small demonstration trades (4 x the minimum lot by default, if the margin allows) on a fixed schedule with all functions on. The tester result shows the tool working; it is not a trading performance. The demonstration never runs on a live or demo account.

SUPPORT AND RESPONSIBILITY
- No profit is promised and no loss level is guaranteed.
- 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 specific funded-account program, cannot be answered.
- A MetaTrader 5 version is sold separately.
More from author
Supply & Demand Zones marks supply and demand zones on a MetaTrader 5 chart with one fixed, fully published rule: a strong bar (body at least X times ATR) that leaves a short "base" of small-body bars behind it. The base becomes a demand zone when the strong bar is bullish and closes above it, or a supply zone when the strong bar is bearish and closes below it. Each zone shows its state: fresh, touched with a count, or broken. It is meant for traders who draw these zones by hand and want them d
FREE
Elliott Wave Auto Count labels Elliott waves automatically on four degrees at the same time: the base degree and the three degrees above it. It follows the rules and guidelines of "Elliott Wave Principle" (Frost & Prechter). For the current wave it also shows a price x time guideline zone and an invalidation level. This is the MetaTrader 4 version; the counting logic is the same as in the MetaTrader 5 version (sold separately). HOW IT WORKS 1. Swings: five ATR(100)-based zigzags. Each higher d
Fibo Price Time Zones combines Fibonacci price levels with Fibonacci time targets and draws them on the chart as boxes (price x time zones). Where boxes from several waves and from up to two higher timeframes overlap, the area is emphasized in three levels. It is meant for traders who already use Fibonacci retracements and extensions and also want to see roughly when a level is worth watching, without drawing every tool by hand. It is a display tool only: it gives no buy or sell signals and doe
VWAP Band Fills with Anchored VWAP is a TV-compatible VWAP for MetaTrader 5. It uses the same formula as the built-in "VWAP" indicator of TradingView (Pine ta.vwap), offers the same inputs - anchor period, source, offset, standard deviation or percentage bands #1 to #3 - and draws it the same way: a blue VWAP line, green / olive / teal bands and light fills between them. An optional anchored VWAP starts from a vertical line that you drag to any bar. HOW IT IS CALCULATED For every bar of the cu
FREE
RSI AutoScale is a clean, lightweight RSI for traders who use both TradingView and MetaTrader 5 and want the two charts to look the same. WHAT IT SHOWS - RSI (Wilder smoothing): the same values as the standard RSI, with any applied price. - Signal line on the RSI: SMA, EMA, SMMA or LWMA, with its own period. - Levels: upper, middle and lower lines (70 / 50 / 30 by default). They use MT5's native levels, so they reach the right edge and their values appear on the scale. - Zone fills: the middle
FREE
Candle Countdown Tag with Spread shows how long the current candle has left, in a small colored tag right next to the last candle - the way TradingView shows its bar countdown. The same tag can also show the current spread, the time left of up to two more timeframes and the open time of the next candle. It is a display tool for MetaTrader 5: no alerts, no signals, no trading. WHAT IT SHOWS - Time left of the chart timeframe: mm:ss under one hour, hh:mm:ss under one day, "2d 04:15:30" for longe
FREE
Stoch RSI Band Fill is a Stochastic RSI indicator for MetaTrader 5. MT5 does not include a built-in Stoch RSI, so this indicator adds one. It follows the same calculation steps as the built-in Stoch RSI on TradingView and uses the same layout: K and D lines, 80 / 50 / 20 levels and a shaded band between the upper and lower levels. CALCULATION, STEP BY STEP 1. RSI of the selected price (default: close, length 14), smoothed with Wilder's method (RMA). The first average is the simple average of the
FREE
Supertrend Trend Fill with Change Alerts is a TV-compatible Supertrend for MetaTrader 5. It uses the same calculation as the "Supertrend" indicator built into TradingView and draws it the same way: a green line below price in an up trend, a red line above price in a down trend, and a light fill between the line and the middle of each candle body. Supertrend shows the direction of the trend. It is a charting aid, not a buy or sell signal, and it does not predict where price will go. HOW IT IS C
FREE
Prior Day Week Month Levels with Touch Alerts draws the previous day, week and month high and low on your MetaTrader 5 chart as clean horizontal lines with labels at the right edge, in the style of TradingView. It can also show the previous day's close and today's open. LEVELS - PDH / PDL: previous day high and low (blue #2962FF, solid) - PWH / PWL: previous week high and low (orange #FF9800, dashed) - PMH / PML: previous month high and low (purple #9C27B0, dash-dot) - PDC: previous day close (
FREE
Do you mark supply and demand zones by hand and get a slightly different result every time? This free MetaTrader 4 indicator draws them with one fixed rule that is written out in full below, so you can check every zone yourself. The idea: a strong candle (body at least X times ATR) leaves a "base" of 1 to 10 small candles right before it. A bullish strong candle that closes above the base turns it into a demand zone; a bearish one that closes below it turns it into a supply zone. The indicator
FREE
Pivot Points Six Types with Level Alerts is a TV-compatible pivot point indicator for MetaTrader 5. It uses the same formulas and the same period boundaries as the "Pivot Points Standard" indicator that comes with TradingView, and it draws the levels the same way: short horizontal lines that start at the first bar of each period, with "R1 (price)" style labels in orange (#FB8C00). SIX CALCULATION TYPES The levels are calculated from the high, low and close of the previous period. - Traditional
FREE
MACD Four Color Histogram is a MACD for MetaTrader 5 that uses the same formula and the same look as the built-in MACD on TradingView. It is made for traders who use both platforms and want the MACD on each chart to read the same way. HOW IT DIFFERS FROM THE MT5 STANDARD MACD - MT5 standard MACD: the histogram is the MACD line itself, and the signal line is an SMA. - This indicator: three parts, as on TradingView. MACD line, signal line, and histogram = MACD - signal. The histogram has 4 colors.
FREE
This is the MetaTrader 4 edition of RSI AutoScale. It draws the standard Wilder RSI with a signal line, a shaded band between the levels, colored areas where the RSI leaves that band, and a choice of three scales. It is meant for traders who use TradingView and MetaTrader 4 side by side and want the RSI pane to look much the same on both. HOW IT LOOKS ON MT4 - RSI line: the same values as MT4's built-in RSI for the same period and applied price. - Signal line: a moving average of the RSI (SMA, E
FREE
Supertrend Trend Fill with Change Alerts MT4 brings a TV-compatible Supertrend to MetaTrader 4. If you also use TradingView, you know its built-in "Supertrend": a green line under price while the trend is up, a red line over price while it is down, and a soft colored band between the line and the candles. This MT4 indicator reproduces that calculation and that look. What it is for: seeing the current trend direction and where it would flip. What it is not: a buy or sell signal or a forecast. A
FREE
VWAP Band Fills with Anchored VWAP MT4 brings the VWAP of TradingView to MetaTrader 4. If you use TradingView's built-in "VWAP", you will find the same inputs here (Anchor Period, Source, Offset, Bands Calculation Mode, Bands Multiplier #1 to #3, Hide VWAP on 1D or Above), the same formula (Pine ta.vwap) and the same colors - plus an anchored VWAP that starts wherever you drag a vertical line. THE FORMULA Within each anchor period, bar by bar: VWAP = sum(source x tick volume) / sum(tick volume
FREE
A MetaTrader 4 MACD built to read like the MACD you see on TradingView: a MACD line, a signal line, and a histogram of the gap between them, colored in four shades. If you switch between the two platforms during the day, the MACD pane on your MT4 chart will look and behave the way you are used to. WHY NOT THE MT4 BUILT-IN MACD? MT4's own MACD draws the MACD line as gray bars and smooths the signal line with an SMA. There is no separate histogram and no color change. This indicator calculates the
FREE
Prior Day Week Month Levels with Touch Alerts MT4 puts yesterday's, last week's and last month's high and low on your MetaTrader 4 chart, drawn the way TradingView users are used to seeing them: thin horizontal lines with a short label and price at the right edge. Optional extras: previous day close and today's open, and an alert when price touches a line. WHAT YOU SEE Line | Meaning | Default look PDH | previous day high | blue #2962FF, solid PDL | previous day low | blue #2962FF, solid PWH |
FREE
MetaTrader 4 ships with a Stochastic and an RSI, but not with a Stochastic RSI. This indicator fills that gap for MT4 users and is built to be TV-compatible: it follows the calculation of the Stoch RSI that comes with TradingView, and the pane looks the way TradingView users expect - a blue K line, an orange D line, dashed 80 and 20 levels, a dotted 50 line and a light band between 80 and 20. WHAT APPEARS IN THE SUBWINDOW - K and D lines. The Data Window lists only K and D. - Upper band (80) a
FREE
Directional Movement DMI with Cross Alerts MT4 brings a TV-compatible DMI to MetaTrader 4. If you also chart on TradingView, you know its built-in "Directional Movement Index": a pink ADX line, a blue +DI line and an orange -DI line in a panel under the price. This MT4 indicator uses the same formula, the same defaults and the same colors. What it is for: reading how strong the recent movement has been (ADX) and whether upward (+DI) or downward (-DI) movement has been larger. What it is not: a
FREE
Pivot Points Six Types with Level Alerts MT4 brings TV-compatible pivot points to MetaTrader 4. If you also chart on TradingView, you know its built-in "Pivot Points Standard". This MT4 indicator reproduces it: the same six calculation methods, the same period choices from one day to ten years, and the same look - an orange (#FB8C00) line for each level, starting at the beginning of each period, labelled like "S2 (1.08345)". WHICH LEVELS EACH METHOD GIVES Method | Levels drawn | Note Tradition
FREE
Ichimoku Cloud Fill with Cross Alerts MT4 brings a TV-compatible Ichimoku Cloud to MetaTrader 4. If you also chart on TradingView, you know its built-in "Ichimoku Cloud": five lines and a soft green or red cloud. This MT4 indicator reproduces that calculation, the same defaults and the same placement of the spans, and fills the cloud with solid color bars instead of hatching. What it is for: seeing where price stands against the middle of recent ranges and how the cloud ahead is shaped. What it
FREE
Candle Countdown Tag with Spread MT4 puts a TradingView-style countdown on your MT4 chart: a small tag beside the last candle that tells you when the bar closes, together with the current spread. Optional extra lines show the time left of two more timeframes and when the next candle opens. Nothing else - it does not trade, alert or give signals. ONE TAG, UP TO FIVE LINES Line | Example | Setting Chart timeframe | 12:41 | on by default Extra timeframe 1 | H4 02:12:41 | off (choose a timeframe t
FREE
Dow Structure MTF shows the Dow theory trend of five timeframes at once in MetaTrader 4, using the pullback low / rally high method that is common among Japanese traders. For each timeframe it shows whether the trend is up, down or range, which price would change it, and how far the current price is from that price. Only closed bars are used, so a confirmed result does not change afterwards (no repaint). It is meant for traders who check the trend structure of several timeframes by hand and wan
Fibo Price Time Zones for MetaTrader 4 combines Fibonacci price levels with Fibonacci time targets and draws them on the chart as boxes (price x time zones). Where boxes from several waves and from up to two higher timeframes overlap, the area is emphasized in three levels. It is meant for MT4 traders who already use Fibonacci retracements and extensions and also want to see roughly when a level is worth watching. It is a display tool only: it gives no buy or sell signals and does not place ord
Time Average Lines draws four averages measured by time, not by the number of bars, so each line keeps the same length of time when you switch timeframes: a time moving average, a TWAP, a same-time-of-day average and a time-based EMA. For the same-time average, the rest of today is shown as a dotted path that joins the past averages; the path is a summary of the past, not a forecast. It is meant for intraday traders who want averages that mean the same thing on M1 and on M15, and who want to co
Auto Trendline Channel MTF draws trendlines, parallel channels and horizontal support / resistance automatically from confirmed swing highs and lows in MetaTrader 4, and records for each line the touch count, close breaks, wick breaks and retests. A table shows, for the chart timeframe and two higher timeframes, the nearest line above and below the price, the distance to it and the Dow theory direction. It is meant for traders who draw trendlines and levels by hand and want them drawn by fixed,
Currency Strength Meter for MetaTrader 4 combines the 28 pairs of the 8 major currencies (USD, EUR, JPY, GBP, AUD, NZD, CAD, CHF) into one strength line per currency, with a ranking table for the chart timeframe, M15, H1, H4 and D1. The full formula is published below. It is meant for MT4 traders who compare currencies before choosing which pair to look at, and who want to know exactly how the numbers are made. It is an analysis aid: it does not tell you when to buy or sell and does not show fu
Trade History Stats Panel for MetaTrader 4 reads the closed trades in your own account history and sums them up in a panel on the chart: number of trades, win rate, profit factor, average P/L per trade, drawdown of the closed-trade curve, holding time, buy / sell, and tables by month, symbol, weekday and hour. It is meant for traders who want to look back at their own past trades, like a trading journal that fills itself in, and to check the numbers by period, symbol or magic number. It never p
Prop Challenge Loss Tracker for MetaTrader 4 shows, in a panel on the chart, how much room is left before the daily loss limit and the maximum loss limit of a funded-account (prop) challenge are reached, and sends staged alerts as the limits are used up. It is meant for traders taking a prop challenge who want to see their remaining loss room at a glance, set to the rules of their own program. It is a display and alert tool only: it never opens, modifies or closes any order. Whether a limit is
Market Structure Liquidity Map for MetaTrader 4 draws smart money concepts (SMC) style market structure on the chart: swing labels, break of structure (BOS), change of character (CHoCH), equal highs and lows, previous day and week levels, liquidity sweeps and unfilled fair value gaps (FVG), with a small table for the chart timeframe and two higher timeframes. It is meant for MT4 traders who read structure and liquidity by hand and want the same levels drawn the same way every time. It is a disp
Filter:
No reviews
Reply to review