Loading…

Chart Sync Master

Traders who run several charts side by side - one for entries, one for a higher timeframe context, one for a correlated pair - lose that layout the moment they flip the master chart to a different symbol or period, because MetaTrader 4 has no built-in "link all charts" feature. Every other chart has to be re-pointed by hand, every time. This EA is attached to whichever chart should act as the master. On a short timer it walks the terminal's chart chain with ChartFirst()/ChartNext() and compares each other chart's symbol and period against the master's. Any chart that has drifted gets ChartSetSymbolPeriod() applied to bring it back in line. There is no push notification from one chart to another in MQL4, so a poll loop is the only mechanism available - this is stated plainly rather than presented as an instant, event-driven sync. Up to two chart IDs can be excluded from the sync so one window can still be browsed freely without fighting the EA - useful for a scratch chart used to eyeball other symbols while the rest of the layout stays locked to the master. Notes and limitations Sync is poll-based, not instant - there can be up to InpPollSeconds of lag between changing the master chart and the followers catching up. If the master chart itself is closed, the EA stops running with it (an EA lives on its chart) - attach it to a chart you intend to keep open for the session. ChartSetSymbolPeriod() can fail if a target chart is showing a symbol not in Market Watch and the terminal cannot resolve it quickly; such failures are logged to the Experts log with the error code rather than retried silently forever. This EA never places or manages trades - it only reads and sets chart symbol/period.

Expert advisor · MT4 · v1.0 · Free

About Chart Sync Master

Chart Sync Master is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Poll seconds, Sync only profile and Alert on sync. MQL source code included.

Files in the download: ChartSyncMaster.ex4, ChartSyncMaster.mq4, ChartSyncMaster.txt.

Settings

SettingDefaultWhat it does
Poll seconds1How often to check for drift (seconds)
Sync only profilefalseRestrict sync to charts in this chart's profile (always true in MT4 - informational)
Alert on syncfalsePop an Alert() each time a follower chart is resynced
Exclude chart10Chart ID to leave unsynced (0 = none). Use for a chart you want to browse freely
Exclude chart20Second chart ID to leave unsynced (0 = none)

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Alerts · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria