Portfolio Heat Manager
"Portfolio heat" is the money every open position's stop-loss implies losing if it is actually hit - added up across every symbol and every running strategy on the account. It is the single number that answers "how much can I still afford to risk right now", and almost nothing on a standard chart shows it, because a chart only ever shows one symbol at a time. Computing it wrong is a real, repeated bug in published risk tools: a hardcoded "$10 per pip per lot" assumption is only true for a standard 100,000-unit USD-quote pair, and is silently wrong on gold, index CFDs and JPY crosses - understating heat on exactly the instruments where a stop-out is most expensive. This tool derives money-per-point from each symbol's own tick value and tick size, scaled by each position's own lot size, so the figure is correct on every symbol a broker lists, not just the one it happened to be tested on. Be clear about what "blocks new entries" can honestly mean on either platform: nothing lets one EA veto another EA's trade request, or a manual click in the terminal. What this tool genuinely does is refuse to place its own demo entry once the configured heat ceiling is spent, and publish a GlobalVariable flag that any other EA you write - your own or a third party's you have modified - can check before sending an order. That is a real, working cooperation mechanism between EAs that agree to use it; it is not a platform-level guarantee, and the notes below say so plainly. Notes and limitations - This tool cannot stop a manual trade or an unmodified third-party EA from opening a position that pushes heat over the ceiling. It can only refuse its own demo entry and publish a flag other code you control can choose to honour. - Money-per-point is derived from each symbol's own tick value and tick size, scaled by each position's own volume - never a fixed per-symbol assumption. - Positions with no stop loss are excluded from the money figure (their risk cannot be quantified) but are counted and, by default, force the whole portfolio into the blocked state - see InpTreatNoStopAsBlocked.
Expert advisor · MT4 · v1.0 · Free
About Portfolio Heat Manager
Portfolio Heat Manager is an expert advisor (trading robot) for MetaTrader 4. It can size trades from your balance and risk percent. It has 12 settings, such as Max heat percent, Magic filter and Treat no stop as blocked. MQL source code included.
Files in the download: PortfolioHeatManager.ex4, PortfolioHeatManager.mq4, PortfolioHeatManager.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Max heat percent | 6.0 | Total portfolio risk ceiling, percent of equity |
| Magic filter | 0 | Only include this magic number in heat (0 = all magic numbers) |
| Treat no stop as blocked | true | Treat the whole portfolio as blocked while any position has no stop loss |
| Global var name | PHM_HeatBlocked | Cooperation flag other EAs can read via GlobalVariableGet |
| Enable demo entry | false | Allow the on-chart button to send a real demo order |
| Demo risk percent | 1.0 | Risk this demo trade would add, percent of equity |
| Demo stop loss pips | 30 | Stop distance for the demo entry, in pips |
| Magic number | 20261212 | Magic number for the demo entry this tool can place |
| Slippage pips | 3 | Slippage tolerance for the demo entry, in pips |
| Max retries | 5 | Attempts per demo entry before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
| Redraw seconds | 5 | Seconds between panel refreshes |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code