Loading…

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

SettingDefaultWhat it does
Max heat percent6.0Total portfolio risk ceiling, percent of equity
Magic filter0Only include this magic number in heat (0 = all magic numbers)
Treat no stop as blockedtrueTreat the whole portfolio as blocked while any position has no stop loss
Global var namePHM_HeatBlockedCooperation flag other EAs can read via GlobalVariableGet
Enable demo entryfalseAllow the on-chart button to send a real demo order
Demo risk percent1.0Risk this demo trade would add, percent of equity
Demo stop loss pips30Stop distance for the demo entry, in pips
Magic number20261212Magic number for the demo entry this tool can place
Slippage pips3Slippage tolerance for the demo entry, in pips
Max retries5Attempts per demo entry before giving up
Retry wait ms500Pause between attempts, milliseconds
Redraw seconds5Seconds between panel refreshes

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria