Skip to content
All library documents

Displaying Open Positions on Charts with Priority-Managed Lines

Article MQL5 articles

Summary

This installment describes building a MetaTrader indicator that displays an open position directly on a chart using horizontal lines for the entry price, stop-loss, and take-profit. The approach reuses the replay system’s existing graphics code and adds object priorities so overlapping chart elements can be selected predictably. The article explains how priority levels distinguish ordinary objects, the Chart Trade panel, and position-related objects, and where the application classes must use those priorities.

The indicator is intended for both replay and live-market use, but the implementation described displays only one position at a time. That is sufficient for a netting account’s single symbol position, but not for multiple simultaneous positions in a hedging account. The article presents this as an incremental design and says support for multiple positions and a remaining drawback will be addressed in later installments; it offers implementation guidance rather than trading-performance evidence.

Key ideas

  • Chart lines can show a position’s entry, stop-loss, and take-profit levels directly on the symbol chart.
  • Assigning different priorities to graphical objects helps users select objects that overlap.
  • The priority system should leave room between object categories for future additions.
  • The described indicator displays only one position, which limits its use on hedging accounts with multiple open positions.
  • The implementation is presented as an incremental visualization tool, not as a trading strategy.

Tags

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