Discussing the article: "Controller Objects for Everything: Draggable Slider Control"

 

Check out the new article: Controller Objects for Everything: Draggable Slider Control.

The article details a complete MQL5 implementation of a draggable slider for controlling ranges on the chart. It introduces the CDragHandle class, private state, public APIs for dimensions, colors, range, and value, plus Refresh* and UpdateHandlePosition logic and event processing. A working example changes CHART_SCALE, demonstrating how to connect the control to platform properties.

Traders and EA developers often need to change chart properties or EA parameters interactively — for example, chart scale, thresholds, or lot size. Standard input parameters are not designed for continuous on-chart adjustment, while plain edit fields offer limited visual and tactile control. A compact, reusable on-chart UI element is therefore useful: it should show the range and current value, allow changing the value by dragging a handle, validate numeric input, coexist with the chart event model (OnChartEvent) without interfering with normal chart interaction, and support multiple independent instances via unique names. In this article, we implement such a draggable slider as a reusable MQL5 class, explain its event-driven behavior, and demonstrate how to integrate it into an EA to control a chart property directly from the chart.

Author: Mehdi Ghorbani Saeidian