Skip to content
All library documents

Inspecting OHLC and Time Data for a Selected Chart Bar

Article MQL5 code base

Summary

This indicator displays the open, high, low, close, and time for a bar selected on the chart symbol. The user can choose a bar by clicking it, entering its index, or adjusting the displayed bar and timeframe with chart controls. The indicator can also highlight the selected bar, helping relate the displayed statistics to the chart.

The document explains an implementation detail: an event is used to handle data collection and display separately from the indicator’s quote-calculation routine. It also lists three ways to retrieve a bar’s data: individual copy functions, direct series functions, or a rates structure. These alternatives are presented as demonstrations of data access, not as evidence that one is faster or more accurate. Mouse selection may interfere with other chart controls, and highlighting can be hard to see when the selected timeframe is no larger than the chart timeframe. The description provides no benchmark or trading performance results.

Key ideas

  • The indicator displays a selected bar’s open, high, low, close, and timestamp.
  • Users can select bars through chart clicks, text entry, or controls for bar index and timeframe.
  • Data retrieval is demonstrated through copy functions, direct series functions, and a rates structure.
  • An event separates display work from quote-calculation processing.
  • Mouse selection can interfere with controls, and small timeframe highlights may be difficult to distinguish.

Tags

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