Break-Even After Costs Line
"Break-even" is usually shown as the entry price, which is wrong the moment commission or swap is involved: a position can sit at its entry price and still be a net loser once those charges are counted. This indicator reads the real open tickets on the current symbol - commission and swap already charged, not an estimate - and draws a line at the price the market must reach to clear them, in whichever direction the position is open. The line is deliberately not moved for the spread. A real buy fills at Ask and is marked to market against Bid, so the spread cost is already the gap between the entry price and the price this line is compared to; adding a second spread offset on top would double count the same cost. Only commission and swap - the two charges Bid/Ask do not already reflect - are converted into a price distance, using the symbol's own tick value and tick size so the conversion is correct for metals, indices and JPY pairs as well as standard forex, and scales correctly with the real lot size on the ticket. When nothing is open, the same maths runs on a hypothetical lot size and direction so the line still means something before a trade is placed. Notes and limitations - If both a buy and a sell ticket are open on the same symbol at once (hedging only - a netting account cannot have both at once, see the MQL4 versus MQL5 section above), the side with more volume is used and the smaller side is ignored; this indicator does not net opposing tickets into one figure. - Commission and swap for a real position are read directly from trade data (OrderCommission()/OrderSwap() on MQL4, position deal history on MQL5), so the line only ever reflects charges already posted - it does not project future swap for nights not yet held. - The hypothetical commission input is a manual estimate, since MT4 exposes no API to read a broker's commission schedule; keep it current if the broker changes it. - This is a price target, not a trade signal - it does not place an order, a stop, or account for slippage on the way to that price.
Indicator · MT5 · v1.0 · Free
About Break-Even After Costs Line
Break-Even After Costs Line is an indicator for MetaTrader 5. It has 7 settings, such as Use open position, Hyp lots and Hyp direction buy. MQL source code included.
Files in the download: BreakEvenAfterCostsLine.ex5, BreakEvenAfterCostsLine.mq5, BreakEvenAfterCostsLine.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Use open position | true | Prefer the real open position on this symbol when one exists |
| Hyp lots | 1.0 | Lot size for the hypothetical case, used only when no position qualifies |
| Hyp direction buy | true | Hypothetical direction: true = buy, false = sell |
| Hyp commission per lot | 0.0 | Hypothetical round-trip commission per lot, account currency |
| Line color | clrGoldenrod | Break-even line colour |
| Line style | STYLE_DASH | Break-even line style |
| Line width | 2 | Break-even line width |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 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: Trailing Stop & Break-even · MT5 Indicator · MQL5 Source Code