Discussing the article: "Chart Synchronization in MQL5 (Part 2): Building an Interactive Multi-Chart Tool"

Check out the new article: Chart Synchronization in MQL5 (Part 2): Building an Interactive Multi-Chart Tool.

This article turns the Part 1 prototype into an interactive MetaTrader 5 indicator that synchronizes charts of the same symbol across different timeframes. It handles keyboard input and drag events via OnChartEvent, traverses charts with ChartFirst/ChartNext, and maps time using iBarShift and ChartNavigate. A draggable vertical line keeps the selected time near the chart center, while a horizontal line propagates a chosen price level. The result streamlines multi-timeframe comparison.

Part 1 introduced a simple problem: synchronizing multiple MQL5 charts to the same point in time, even across different timeframes.

The first implementation demonstrated the basic idea. A time value was selected on one chart, converted into the appropriate bar position on each target chart, and the charts were navigated to the corresponding location. This established the core principle of the synchronization system:

Time should be used as the common reference between charts, not bar index.

However, the prototype was still limited. Synchronization could be triggered, but the user had no practical way to interact with the synchronized point after it was created. A useful charting tool needs more than one-time navigation. Users should be able to create a visible reference point, move it on the chart, and propagate updates to other charts. The same interaction should also be available for price levels.

This leads to the next stage of the project.

In Part 2, the prototype is developed into an interactive multi-chart synchronization indicator. Pressing V creates or removes a vertical synchronization line based on the current chart's visible time. Pressing H does the same for a horizontal line representing the current visible price. Once created, these lines can be dragged to update the corresponding reference across eligible charts.

The implementation is designed to synchronize charts of the same symbol, even when they use different timeframes. For time synchronization, the indicator converts the selected time into the corresponding bar on each chart and uses chart navigation to position it near the center of the visible area. Price synchronization, in contrast, propagates the selected price level without changing each chart's vertical scale.

Author: Mohammadreza Mahdi Mavaddat