Skip to content
All library documents

Adding a Crosshair, Magnifier, and Distance Measurement to an MQL5 Chart

Article MQL5 articles

Summary

The article explains how to extend an MQL5 drawing palette with cursor-focused chart inspection tools. Its crosshair manager coordinates canvas layers for reticle ticks, full-chart horizontal and vertical lines, and price and time labels at the axes. A circular lens renders enlarged candle details, while a double-click sets a measurement anchor and displays the bar count and price and pip distances to the moving cursor.

Implementation topics include configurable appearance inputs, a Bresenham line routine for drawing the measurement diagonal, and event handling that tracks cursor movement, detects double-clicks, hides overlays over the sidebar, and refreshes colors when the theme changes. The author reports compiling and attaching the program, then observing responsive labels, candle rendering, and measurement behavior. These are qualitative checks; the article gives no benchmark or independent assessment of accuracy, performance, or trading benefit. The described tools support visual chart inspection and are not presented as a trading signal or strategy.

Key ideas

  • A canvas-based crosshair can show cursor position with chart-spanning lines and edge labels.
  • A circular magnifier enlarges nearby candle features without changing the chart's overall zoom.
  • Double-click measurement mode connects an anchor to the cursor and reports bars and price distance.
  • Separate canvas layers and event handling manage overlays, sidebar hiding, and theme updates.

Tags

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