Floating Profit Histogram
Most traders watch floating P/L as a single number on the terminal toolbar, which shows where things stand right now but nothing about the shape of the session - whether a position spent an hour underwater before recovering, or has been bleeding continuously since it opened. This indicator plots that number as a live histogram in a separate window, so the pattern is visible at a glance instead of only the current instant. Every open order is summed each tick: profit, and optionally swap and commission, filtered to the current chart's symbol or the whole account depending on InpCurrentSymbolOnly. The figures used are the broker's own OrderProfit(), OrderSwap() and OrderCommission() values, never a distance-times-lot-size calculation done by hand. That choice matters because a manually reconstructed P/L that assumes a fixed contract size is wrong the moment it meets an instrument with a non-standard one - gold, an index CFD, a mini lot symbol - while the broker's own per-order figures are correct by construction. A corner label reports the current floating figure, how long it has been continuously negative, and the worst floating drawdown seen since the indicator was attached, giving a quick read on how deep and how long the current excursion has gone. Notes and limitations - MT4 keeps no historical record of past open-position state, so only the current, still-forming bar is ever plotted - history before the indicator was attached is left empty, not reconstructed. - The "worst seen" figure and underwater timer reset when the chart or terminal restarts; they are session statistics, not a permanent log. - With InpCurrentSymbolOnly = false the histogram reflects the whole account, so it is not meaningful to compare directly against a single symbol's price action.
Indicator · MT4 · v1.0 · Free
About Floating Profit Histogram
Floating Profit Histogram is an indicator for MetaTrader 4. It has 2 settings, such as Current symbol only and Include swap commission. MQL source code included.
Files in the download: FloatingProfitHistogram.ex4, FloatingProfitHistogram.mq4, FloatingProfitHistogram.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Current symbol only | true | true: only positions on this chart's symbol, false: whole account |
| Include swap commission | true | Include swap and commission in the floating figure, not just raw profit |
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 → Indicators.
- 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 indicator from the Navigator onto a chart and adjust the settings.
Tags: Trading Sessions · MT4 Indicator · MQL4 Source Code