Skip to content
All library documents

Estimating Open-Position Profit and Loss at a Chosen Price

Article MQL5 code base

Summary

This trading utility estimates the deposit-currency profit or loss of open market orders on the current chart symbol at a hypothetical price. The trader places a horizontal line named LP, and the calculation updates as the line moves, showing the projected result at its price.

A MagicNumber parameter can restrict the calculation to orders with a specified magic number; setting it to -1 includes orders for the current symbol without that filter. The document describes a chart-side calculation aid, not an entry or exit strategy. It provides no accuracy tests, formula details, or evidence about how well the estimate handles broker-specific contract or currency conversion rules, so results should be treated as an estimate.

Key ideas

  • A horizontal chart line sets the hypothetical price used to calculate open-order profit or loss.
  • The estimate is expressed in the account deposit currency.
  • A magic number can filter which orders are included, while -1 selects all orders for the current symbol.
  • The utility measures hypothetical exposure and does not define a trading strategy.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.