Portfolio exit management / FREE ATAI TOOL

ATAI Basket Money Manager

One basket. Clear money-based exit rules.

Free downloadVersion 17.01MT5 desktopNo licence key

A free MT5 exit manager for positions you choose. Monitor the basket’s floating result, set a cash loss threshold, lock part of an improving profit and trail it through three stages. It does not open trades, generate entries or cancel pending orders.

READY FOR YOUR TERMINAL

Download your edition.

A free ATAI account gives you access to these downloads. No purchase is required.

Compiled files · Install in the desktop terminal’s Experts folder · Full settings remain available

ATAI Basket Money Manager product artwork
  • Free · MT5 · no licence key
  • Filter by symbol, magic number and direction
  • Combined or separate buy/sell baskets
  • Money-based virtual loss limit
  • Initial profit lock + three trailing zones
  • Gross P/L and trading costs shown separately

You stay in control of the entries. Read the management scope and exit behaviour before enabling Algo Trading.

01 / USER GUIDE

Install on MetaTrader 5

  1. Download the MT5 .ex5 file below. Sign in to your free ATAI account if asked. No purchase, licence key or source-code compilation is required.
  2. In the exact MetaTrader terminal you use for this account, choose File → Open Data Folder. Open MQL5 → Experts and copy the .ex5 file into that folder. Do not use MQL4, Indicators or the terminal installation folder.
  3. Return to MetaTrader. Open Navigator (Ctrl+N), right-click Expert Advisors and choose Refresh. If the tool is missing, restart this terminal and check that you copied the file into its own data folder.
  4. Open the instrument you want to manage and drag the EA from Navigator onto its chart. The chart timeframe does not set its exit rules. Review Inputs before clicking OK.
  5. Enable Algo Trading on the terminal toolbar and Allow Algo Trading in the EA’s Common tab. Your account must allow trading; an Investor/read-only login cannot send or modify orders. DLL imports and WebRequest access are not required for this tool.
  6. Keep MetaTrader open, connected and awake while management is needed. Use separate charts for separate EAs: attaching another EA to the same chart replaces the current one.
02 / USER GUIDE

Choose exactly which positions to manage

  1. With no positions open, attach the EA and review its filters. By default it manages manual positions (magic 0) on the current chart symbol, with buys and sells combined.
  2. To manage another EA’s positions, set MagicNumberToManage to that EA’s magic number and keep ManageOnlyThisMagic = true. Setting that filter false includes all magic numbers within the selected symbol/direction scope.
  3. Keep ManageCurrentSymbolOnly = true for a single instrument. If you set it false, eligible positions across the account are combined in money terms; one chart price cannot represent that multi-symbol basket.
  4. Set HardSLMoney, the initial profit lock and trailing-zone values in the account’s displayed currency. Verify the selected position count, lots and gross P/L on the dashboard before relying on them.
  5. Enable Algo Trading and keep the terminal running. There is no Start button: monitoring starts when the EA is attached and the selected positions are present.
03 / USER GUIDE

What 5 and 1 mean

With UseRiskFreeSL = true, RiskFreeStartProfit = 5 and RiskFreeLockProfit = 1, the EA waits until the selected basket reaches +5 of gross floating profit. It then sets a virtual close threshold at +1. If gross profit falls back to that level, it requests closure of the selected positions. It does not close merely because profit first reaches +5.

These are account-currency amounts. On a USD account they mean $5 and $1; on a cent-denominated account they are displayed cents. They are neither gold-price distances nor percentages of equity.

The input name UseRiskFreeSL does not mean risk is eliminated. This is a local profit lock based on gross profit; commission, swap, spread changes, slippage and execution delay can make the final net result different.

How the default trailing zones workClick to view defaults and explanations
Setting / stageDefaultMeaning
Before the +5 trigger −20 gross close threshold HardSLMoney = 20 requests closure when the selected basket’s gross P/L reaches −20.
From +5 peak +1 gross lock The initial lock is active. It protects a money threshold rather than closing the basket immediately.
Zone 1: peak ≥20 50% giveback Protect 50% of the highest observed gross profit. A +40 peak gives a +20 close threshold.
Zone 2: peak ≥200 25% giveback Protect 75% of the peak. A +200 peak gives a +150 close threshold.
Zone 3: peak ≥1000 10% giveback Protect 90% of the peak. A +1000 peak gives a +900 close threshold.
05 / USER GUIDE

How the exit is calculated

The active trailing formula is peak gross profit × (1 − giveback percentage / 100). The EA keeps the highest protection level already established in the current running basket, including an active initial profit lock or a higher manual lock. A return to or below that close level triggers close requests.

Gross floating P/L drives the rule. Commission and swap are displayed separately, with an estimated net figure. A gross +1 close level is not a promise of +1 net profit, and a −20 trigger is not a guaranteed maximum realised loss.

The EA sends close requests for the selected open positions. It does not cancel pending orders, and those orders can subsequently open new positions. Check the Trade tab and Experts log to confirm every requested close was accepted.

Settings: scopeClick to view defaults and explanations
Setting / stageDefaultMeaning
ManageCurrentSymbolOnly true Only the chart symbol. False includes other symbols that pass the remaining filters.
MagicNumberToManage 0 Magic number identifying the positions to manage; 0 normally means manual trades.
ManageOnlyThisMagic true Enforce MagicNumberToManage. False removes this filter.
ManageBuyPositions true Include buy positions.
ManageSellPositions true Include sell positions.
ManageBuyAndSellTogether true Combine selected buys and sells into one cash basket. False manages a buy basket and a sell basket independently, each with its own peak and thresholds.
Settings: money thresholdsClick to view defaults and explanations
Setting / stageDefaultMeaning
HardSLMoney 20.0 Positive gross-loss threshold in account currency. A value of 20 represents −20, not +20. This version requires a value above zero; 0 is not a disable switch.
UseRiskFreeSL true Enable the initial virtual profit lock. False disables this early lock, not the three trailing zones.
RiskFreeStartProfit 5.0 Peak gross profit needed to activate the early lock. A non-positive value prevents this early trigger.
RiskFreeLockProfit 1.0 Gross money level to protect once the early trigger is reached. It is constrained between 0 and the trigger amount.
Zone1StartProfit 20.0 Peak gross profit needed to enter the first trailing region.
Zone1GivebackPercent 50.0 Percentage of peak gross profit allowed to be given back in Zone 1.
Zone2StartProfit 200.0 Peak threshold for Zone 2. Keep zone thresholds in increasing order.
Zone2GivebackPercent 25.0 Percentage of peak gross profit allowed to be given back in Zone 2.
Zone3StartProfit 1000.0 Peak threshold for Zone 3.
Zone3GivebackPercent 10.0 Percentage of peak gross profit allowed to be given back in Zone 3. Giveback values are constrained to 0–100%.
Settings: draggable linesClick to view defaults and explanations
Setting / stageDefaultMeaning
AllowMouseDragHardSLLine true Allow the red virtual loss line to be moved; the new price is converted to a money threshold for the selected basket.
AllowMouseDragTrailingLine true Allow the yellow virtual close line to be moved after profit protection is active.
ManualTrailingNeverMovesDown true Prevent a lower manual money lock from replacing a higher manual lock. The active basket close level also retains its highest established value, even if this is false.
ResetManualLinesOnBasketChange true Reset manual line overrides when the selected position count or total lots changes. This does not restart the existing observed peak while the basket remains open.
DrawChartLines true Show the available entry and virtual close levels. Turning off drawings does not disable money-based management.
EntryLineColor Lime Entry-reference line colour.
HardSLLineColor Red Virtual loss-line colour.
TrailingLineColor Yellow Virtual profit-close line colour.
LineWidth 2 Base line width; draggable lines are drawn wider.
Settings: dashboard and refreshClick to view defaults and explanations
Setting / stageDefaultMeaning
ShowDashboard true Show or hide the information panel; management continues when hidden.
DashboardBackColor Navy Panel background.
DashboardBorderColor DeepSkyBlue Panel border.
DashboardHeaderColor DodgerBlue Header background.
DashboardTextColor White Primary text colour.
DashboardAccentColor Aqua Accent colour.
DashboardX 10 Left offset in pixels.
DashboardY 20 Top offset in pixels.
DashboardWidth 640 Panel width in pixels.
DashboardHeight 360 Panel height in pixels.
TimerSeconds 1 Extra management check interval, minimum 1 second. Checks also run on price ticks; this is not a broker execution-time guarantee.
PrintDebug true Write basket/threshold diagnostics to Experts. Set false to reduce repeated diagnostic messages.
10 / USER GUIDE

Virtual levels, restarts and missing lines

HardSLMoney and the yellow profit level are virtual thresholds monitored inside this EA; they do not place a protective SL at the broker. If MetaTrader closes, loses connectivity or cannot trade, these rules cannot execute. Keep it running on a connected computer or VPS.

Peak profit and manual lock state are kept in memory in this version. Removing or reinitialising the EA, changing its Inputs or restarting the terminal resets that state; it cannot reconstruct a previously observed peak from the current floating result. Review the basket again after any such change.

A multi-symbol basket or certain hedged buy/sell combinations may have no meaningful single price for a cash threshold. The money rule can still operate when a price line is not shown. Green is an entry reference, red is the virtual loss threshold and yellow is the active virtual profit threshold.

Use separate management scopes when running other EAs. Do not let the Trade Panel and Basket Money Manager control the same positions unless you have deliberately designed and tested that combined behaviour.

11 / USER GUIDE

Troubleshooting

No positions on the panel: check chart symbol, magic number and buy/sell filters. Most manual trades use magic 0, but trades placed by an EA usually do not.

Gross and net differ: the exit rule uses gross floating profit; commission and swap are separate. This also explains why MetaTrader totals may differ from the chosen basket’s result.

The basket passed a level without closing: check Algo Trading, the account’s trading permission, connectivity, market availability and broker return messages. A virtual threshold cannot guarantee an execution price or time.

A drag is not accepted: move the line outside the dashboard and confirm a valid price-to-money conversion is possible for the selected basket.

No WebRequest permission, external API key or DLL access is required for Basket Money Manager.