Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Libraries

Account Settings Sync - Bidirectional EA Settings Across Charts - library for MetaTrader 5

Sayed Ali Ordibehesht
Sayed Ali Ordibehesht
EA PRO TEAM is an independent trading software brand founded by Sayed Ali Ordibehesht, a trader and software developer.
We build professional MetaTrader 5 tools and trader productivity solutions for risk management, trade execution, automation and performance analysis.
Views:
58
Rating:
(2)
Published:
\MQL5\Include\AccountSettingsSync\ \MQL5\Experts\AccountSettingsSync\
MQL5.zip (5.83 KB)
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

AccountSettingsSyncDemo on EURUSD,H1 and GBPUSD,H4

AccountSettingsSyncDemo on EURUSD,H1 and GBPUSD,H4 of the same demo account: the same four values at shared revision 18.

Overview

Account Settings Sync is a small MQL5 library for sharing an EA's own runtime settings between charts of the same account. Changes can originate from either chart. It does not modify MQL5 input variables or the platform's Inputs dialog.

The example has exactly four interactive controls: Risk %, Daily loss limit %, Risk alert ON/OFF and Daily alert ON/OFF. These are sample settings only: the package contains no risk engine, drawdown execution, notification delivery or trading commands.

Synchronization

An independent channel and a hash of the broker server and account login identify the shared record. The symbol is excluded. Each operation obtains an exclusive file-handle lock, retrying briefly while another chart holds it. Publishing rereads the latest record, merges only the field being changed, writes and flushes a temporary file, and replaces the shared record with an incremented revision.

This avoids replacing another chart's different-field change with a stale full snapshot. If both charts change the same field, the last successfully saved value wins. Failed operations return false and report an error; an unsuccessful edit must be retried.

The demo polls every 250 milliseconds, without waiting for ticks. This is a timer setting, not a measured latency guarantee. A remote refresh does not replace active or modified local numeric text. Enter commits the edit; MT5 can also end editing when focus leaves the box.

Installation and use

Extract the MQL5 directory from MQL5.zip into the terminal's Data Folder, preserving its subdirectories. Compile MQL5\Experts\AccountSettingsSync\AccountSettingsSyncDemo.mq5. Its relative include resolves to MQL5\Include\AccountSettingsSync\AccountSettingsSync.mqh. No DLL, credentials, network permissions or external package is required.

Attach the demo to two different-symbol charts of the same demo account, using the same InpChannel on both. The default CodeBaseDemo channel and ASS prefix are independent from the original panel. Do not replace an EA that you need to keep running.

For integration, create one CAccountSettingsSync instance, initialize all four ASSSettings.values entries, and call Init(channel, defaults). Publish(field, value) saves one field. Call Sync(changed) from your timer, check its Boolean result, and obtain the committed snapshot with Snapshot(settings, revision). LastError() supplies an error message. The complete initialization and event-handling example is in the demo.

//+------------------------------------------------------------------+
//| Save the runtime risk percentage                                 |
//+------------------------------------------------------------------+
bool SaveRisk(CAccountSettingsSync &store,const double percent)
  {
   return store.Publish(ASS_RISK_PERCENT,percent);
  }

Files

  • AccountSettingsSync.mqh: synchronization library under MQL5\Include\AccountSettingsSync.
  • AccountSettingsSyncDemo.mq5: four-control example under MQL5\Experts\AccountSettingsSync.
  • MQL5.zip: both sources in the intended installation layout.

Storage and limitations

The fixed layout stores two finite percentages from 0 to 100 and two binary switches. The demo accepts up to two decimal places. FILE_COMMON files use ASS.channel.context-hash names, with .bin, .lock and temporary .tmp companions. The lock is held by the open handle, not the mere existence of its filename.

The common folder can be shared by terminal installations in the same Windows environment. Matching server, login and channel can therefore also share settings between those installations; cross-terminal operation has not been tested. Use distinct channels for isolation. There is no remote/VPS synchronization, automatic migration, encryption, schema conversion or power-loss guarantee. Files persist locally; the Global Variable four-week expiry does not apply. Account changes require reinitializing the EA.

Validation status

Tested on one MT5 terminal with a demo account, using EURUSD,H1 and GBPUSD,H4 charts on the same channel. All four controls were changed from each chart and appeared on the other. Two different fields changed from the two charts about 24 ms apart were both kept. Unfinished numeric text on either chart was kept while another program published a different field through the library. Invalid text such as 1.754.4 was rejected without changing the record. Compilation: 0 errors, 0 warnings.

Not tested: several terminals sharing the common folder, different accounts, VPS, crash or power-loss recovery and heavy contention.

Related approaches

External JSON strategy configuration describes another shared EA configuration approach. Storing and exchanging parameters covers file-based exchange. This example focuses on two-way chart editing, a locked per-field merge and preserving unfinished local UI text, not copying trades or synchronizing chart appearance. It makes no claim to have invented shared EA settings.

Why Your Indicator Gives Different Values on Another Broker Why Your Indicator Gives Different Values on Another Broker

Checks the bar history of the chart for six defects that make an indicator give different values on another broker: missing bars, impossible values, filler bars, repeated bars, bars without ticks and price spikes. Every defective bar is marked in the indicator window, and a panel gives a health score for the symbol and timeframe, the largest holes, the defect counts and one line that can be pasted into a comment to compare brokers.

Indicator Doctor: Find Out Why Your MT5 Indicator Shows Nothing on the Chart Indicator Doctor: Find Out Why Your MT5 Indicator Shows Nothing on the Chart

finds out why an indicator shows nothing on the chart. It reads the buffers of every other indicator on the chart and gives each one a verdict: not calculated, all values empty, values only in the newest bars, all values zero, no values in the visible bars, or values outside the visible scale. A panel lists the problems first, gives one line of advice and prints a report line that can be pasted into a comment.

Swing Level Breaks Graded by Volume Swing Level Breaks Graded by Volume

Draws support and resistance from confirmed swing points and keeps each level live, with its price on the chart, until a close breaks it. Every break is graded on the spot: an arrow when volume surges, a diamond when the candle shows a rejection wick, a hollow circle when price slipped through without either.

MACD Signals MACD Signals

Indicator edition for new platform.