Skip to content
All library documents

Measuring Indicator Repainting with Closed-Bar Buffer Checks

Article MQL5 code base

Summary

Repaint Inspector is a method for checking whether a technical indicator revises values on bars that have already closed. It records each bar’s first observed buffer value, then compares later readings, classifying revisions as changed values, newly appearing values, or vanished values. It identifies bars by their open times and can optionally recreate the indicator handle periodically to check whether a reload changes its historical output. Events and summary counts are saved for audit.

Examples using built-in MetaTrader indicators distinguish unstable history from delayed confirmation. ZigZag removes previously published values, while a moving average showed no revisions in the reported run; fractal signals appeared at a consistent delay. These examples illustrate why the event type and the depth of affected history matter. The measurements do not establish that a stable indicator is profitable or prove that repainting never occurs: short-lived changes can fall between checks, and indicators that draw chart objects rather than expose buffers are outside the method’s reach. Live market conditions may also differ from Strategy Tester behavior.

Key ideas

  • The method stores each closed bar’s first buffer reading and compares it with subsequent readings.
  • It separates changed, appeared, and vanished values to describe different forms of historical revision.
  • The greatest historical shift affected helps distinguish shallow updates from deeper repainting.
  • Periodic handle recreation can reveal indicators that publish different histories after reload.
  • Sampling can miss brief events, and buffer checks cannot inspect indicators that draw chart objects.

Tags

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