Skip to content
All library documents

Calculating Position Profit and Loss at Executable Bid and Ask Prices

Article MQL5 articles

Summary

This installment in a market replay and simulation series develops a position display that marks an open position’s result in price points. It folds a former helper class into the indicator so the logic can directly access the opening-price graphic, then explains why the displayed result should use the quote available to close the trade. A long position is valued against Bid, while a short position is valued against Ask, reflecting the spread paid on exit.

The article contrasts these executable quotes with chart prices and the platform’s position-profit field, which may not reflect the same exit-side price in every charting setup. The code is an educational component of a broader replay and trading interface, and this installment omits volume and monetary P&L calculations. The author advises local or demo use while the system is being understood; the indicator is not presented as a finished, error-free trading application.

Key ideas

  • A position view can compare current exit-side pricing with the position’s opening price.
  • Long positions should be evaluated using Bid and short positions using Ask to reflect closing costs.
  • Chart price and platform-reported profit may not match the executable exit result.
  • The installment covers price-point profit or loss and defers volume and monetary calculations.
  • The implementation is educational and part of a larger replay and trading interface.

Tags

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