Live Payoff Diagram
Options traders are used to seeing their whole position as a single payoff curve: profit or loss plotted against where the underlying ends up. A spot trader carrying several positions on one symbol has no equivalent view - only a running total P/L figure that says nothing about what happens if price moves further, or reverses. This indicator builds that missing view directly from the live order pool: it sweeps a range of hypothetical prices around the current market, recomputes what total account equity would be at each one using every open position's actual lot size, direction and entry price, and plots the result as a line that updates on every tick. Only positions on the chart's own symbol can be swept, because sweeping several correlated or uncorrelated symbols' prices at once has no single well-defined X axis - there is no one number that represents "EURUSD moves this much AND USDJPY moves that much" on one line. Positions on every other symbol are folded into the curve as a constant offset (their own current floating P/L, unchanged across the sweep), so the Y axis still reads as genuine total account equity - just with only this symbol's contribution actually varying left to right. This is stated plainly on the panel and here so the curve is never mistaken for a true multi-symbol payoff surface. Money-per-price-unit is read from the broker's own MODE_TICKVALUE and MODE_TICKSIZE for the symbol, never a hardcoded contract size, so the curve is correct on FX, metals and index CFDs without adjustment. MT4 has no native chart object indexed by an arbitrary swept variable - only time and price. The swept price becomes the panel's Y axis (plotted in a subwindow, so it auto-scales correctly to the account's actual equity range) and the sweep samples are carried on a block of the chart's own recent bar slots purely as an X-axis mechanism, with price labels drawn along the curve so the axis stays readable despite riding on the time axis underneath it. Notes and limitations - Only this-symbol positions actually respond to the sweep; every other symbol's floating P/L is included as a constant, clearly documented, not swept alongside the chart's own symbol. - The X axis rides on real chart bar times purely as a coordinate mechanism - the timestamps under the curve carry no meaning of their own. - Pending orders are not included; only open market positions contribute to the swept or constant portions of the curve. - Needs at least a few bars of the chart's own history to anchor the sweep's coordinate slots and to compute ATR; on a brand-new chart with very little history the curve may not draw until enough bars are available. - This is a read-only visualisation. It never opens, closes or modifies any position.
Indicator · MT4 · v1.0 · Free
About Live Payoff Diagram
Live Payoff Diagram is an indicator for MetaTrader 4 based on ATR. It has 6 settings, such as Range atr, Atr period and Magic filter. MQL source code included.
Files in the download: LivePayoffDiagram.ex4, LivePayoffDiagram.mq4, LivePayoffDiagram.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Range atr | 3.0 | Sweep half-range, expressed in ATR multiples either side of the current price |
| Atr period | 14 | ATR period used to size the sweep range |
| Magic filter | -1 | Only include this-symbol positions with this magic number, -1 = all |
| Refresh secs | 1 | Panel refresh interval, in seconds |
| Now color | clrYellow | Colour of the "current price" marker and label |
| Label color | clrSilver | Colour of the price-axis text labels |
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: ATR · MT4 Indicator · MQL4 Source Code