Skip to content
All library documents

Candle Size Indicator and Chart Object Synchronization

Article MQL5 code base

Summary

This document explains an indicator that displays the size of a price bar as the difference between two selected OHLC values. The minuend and deduction can each be the open, high, low, or close, allowing different candle ranges or price relationships to be shown. An input limits how many bars are displayed, and that count stays fixed when new bars appear.

The remaining discussion concerns implementation details for synchronizing graphical objects with bars on a chart. It describes naming objects by bar type and timestamp, tracking their names in an array, and deleting them during initialization, recalculation, or shutdown to avoid stale objects and keep the displayed object count aligned with the selected bars. This is a technical description of indicator behavior and chart housekeeping, not a trading signal or strategy. It offers no market evidence or evaluation of whether any particular candle measurement is useful for trading.

Key ideas

  • The indicator measures a bar by subtracting one selected OHLC value from another.
  • Either value may be the open, high, low, or close.
  • An input controls the number of bars displayed and preserves that limit as new bars form.
  • Chart objects are named using the bar type and timestamp, then cleared during relevant lifecycle events.
  • The document gives no evidence that the displayed measurements predict market behavior.

Tags

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