Advertisement IC Markets

Settings files vs hardcoded inputs: managing EA parameters across accounts

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Settings files vs hardcoded inputs: managing EA parameters across accounts

Post by Fairman »

Naming set files clearly saves a lot of confusion. Including the EA name, the symbol, the account type and the date in the file name means you can tell at a glance which settings are which. Something like EA_EURUSD_raw_2026-10.set is much better than settings_final_v2.set. When you have several accounts and several versions, a good naming convention is the difference between loading the right file and loading last month's test settings onto a live account by mistake. That mistake is surprisingly easy to make on a busy morning. A short readme next to the set files, saying which account uses which, helps too.
It’s Fairman :geek:
Recommended broker for automated trading & scalping IC Markets
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Settings files vs hardcoded inputs: managing EA parameters across accounts

Post by Fairman »

A useful habit is having the EA print all its input values to the log when it starts. That way, if you're not sure which settings are running on a given account, you can check the log and see exactly what was loaded. It also helps when comparing live results with a backtest, since you can confirm that the live settings actually match the ones you tested. It's a few lines of code, and it removes a lot of guessing when something behaves differently from what you expected. The log also gives you a record of when settings were changed, which is handy later.
It’s Fairman :geek:
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Settings files vs hardcoded inputs: managing EA parameters across accounts

Post by Fairman »

The startup log is the habit I'd copy first. Mine only printed "EA started", and after one account lost 4 percent in two days I couldn't say whether the risk input was 0.5 or 1.0 on that chart. It turned out someone, me, had loaded an old preset. Logging every input at init would have shown it in thirty seconds.

On the settings file route, I run a small CSV per account with columns like account number, symbol, risk percent and max spread. The EA reads its own row by account number on startup and refuses to trade if it doesn't find one. That blocks the classic mistake of a demo preset landing on a live account.

For a worked example, if the live account is 20,000 dollars and the risk should be 0.25 percent, that's 50 dollars. A wrong input of 2.5 percent is 500 dollars on the first trade, so a validation check that rejects anything above, say, 1 percent is cheap insurance.

How do you handle changing a value in the file while the EA is running? Re-read on a timer, or only on restart? And do you version the files somewhere, like a dated copy each time something changes?
It’s Fairman :geek:
Post Reply