MQL5 Vertical Scrollbars and Fast Bar-Time Calculation
Summary
This article extends a graphical controls library with a vertical scrollbar that appears when attached content exceeds its parent form’s height. It adapts an existing horizontal scrollbar and also discusses correcting premature redraws that caused clipped graphical elements to blink. Additional interface changes let callers choose whether visible-area settings affect only element properties or the physical object, and add methods for adjusting RGB components and color appearance.
For time-series utilities, the article presents a calculation for finding the start time of a bar from a timestamp and timeframe without consulting bar history. It is intended for cases where an event occurred within a candle and speed matters, but the author explicitly says it does not replace the history-based bar-shift function. The calculation has a stated date limit, and the article offers no benchmarks. Its test section reports that the vertical scrollbar behaves like its horizontal counterpart when content extends beyond the panel.
Key ideas
- A vertical scrollbar can be adapted from a horizontal one to handle content extending beyond a form’s top or bottom.
- Removing an early redraw addresses blinking caused by displaying content before clipping it to its parent.
- The fast bar-start calculation derives a candle boundary from time and timeframe without relying on bar history.
- The calculation is not a substitute for a history-based bar lookup and has a stated date limit.
- Added graphical methods support color-component changes and configurable visible-area updates.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.