MQL Export Options

The MQL Export Options page configures the account protections, news filter, and stats panel that are included in every exported Expert Advisor.

The enabled options change the Expert's behavior during trading: they can block new entries, close positions, or turn the Expert off. Carefully test the exported Expert Advisors in the MetaTrader tester and on a demo account before going live.

The options affect only the exported Experts. They do not change the backtesting inside Strategy Builder Professional.

How the options work

  • Each numeric protection is active only when it is higher than zero. Zero disables the protection.
  • Entry protections apply account-wide: the exported Expert counts the positions and volume of all Experts on the account, not only its own.
  • In a Portfolio Expert Advisor (Portfolio → Export → Portfolio Expert MT5) the account-wide settings of this page are applied once, by the wrapper: the open-position and open-lot caps, the daily and equity protections, the news filter and the stats panel. One breached limit therefore stops every strategy's entries at once, and one statistics panel reports the whole portfolio. What stays per strategy is its own max spread (measured in its own market's points), its entry amount and its features. A breached daily loss or drawdown suspends every strategy's entries until the reset hour and closes the portfolio's own positions; a breached equity protection (minimum equity, maximum equity, maximum equity drawdown) closes them and removes the Expert from the chart. The Portfolio Expert guide spells the split out.
  • When a protection closes positions, the Expert leaves a message on the chart explaining what was triggered.

The page is part of the Settings group, beside the Settings page.

Entry Protections

Entry protections block new entries from all Expert Advisors on the account.

Max open positions (all experts) — prevents new entries when the total number of open positions across all Expert Advisors on the account reaches this value. Default 0 (disabled), integer.

Max open lots (all experts) — prevents new entries when the total open volume across all Expert Advisors on the account reaches this value. Default 0 (disabled), step 0.01.

Daily Protections

Daily loss and drawdown limits, suitable for Prop Firm accounts.

Maximum daily loss (currency) — closes all open positions and suspends new entries when the daily loss reaches this value. Measured in account currency. Default 0 (disabled), integer.

Maximum daily drawdown % — closes all open positions and suspends new entries when the drawdown over the last 24 hours reaches this percent. Default 0 (disabled), step 0.01.

Daily reset hour — the terminal-time hour when the daily loss and drawdown counters reset and the entry suspension is lifted. Values from 0 to 23. Zero disables the reset. Use it together with a daily loss or drawdown cap.

Account Protections

Equity limits that close all positions and stop trading when reached.

When an account protection is triggered, the Expert closes the open position, leaves a message on the chart, and turns itself off.

Minimum equity (currency) — closes all positions and stops trading when the account equity drops down to this level. Default 0 (disabled), integer.

Maximum equity drawdown % — closes all positions and stops trading when the equity drawdown from the highest recorded equity reaches this percent. Default 0 (disabled), step 0.01.

Maximum equity (currency) — closes all positions and stops trading when the account equity reaches this level. Default 0 (disabled), integer.

News Filter

The news filter prevents new entries during economic news events.

The exported Expert reads the economic calendar of MetaTrader for the configured currencies and blocks entries during the before/after windows of the selected importance levels. The calendar is available on live and demo accounts; it is not read in the strategy tester.

News priority — what the filter blocks: News filter disabled (default), High news filter, or High and Medium news filter.

News currencies — comma-separated currency codes of the economic news to watch. Default USD,EUR,JPY,GBP,CHF.

Before High news (minutes) — minutes before a High importance event during which new entries are blocked. Default 2.

After High news (minutes) — minutes after a High importance event during which new entries are blocked. Default 5.

Before Medium news (minutes) — minutes before a Medium importance event during which new entries are blocked. Default 2.

After Medium news (minutes) — minutes after a Medium importance event during which new entries are blocked. Default 2.

News records to show — number of upcoming news records shown on the chart stats panel. Default 10, minimum 1.

Bar Close

Bar close advance (seconds) — the Bar Close exit point fires this many seconds before the expected bar close, because MQL5 has no Bar Close event. Default 15.

On Friday, the expected close is the detected Friday market close — an H4 or D1 bar may not be completed there.

Zero disables the advance and the exit falls back to the next bar open. New entries stay blocked after the close event until the next bar.

The value applies to every market and is not adjusted per market. A market that closes every session would in principle want the exact session close, but zero does not deliver it: nothing raises the close event any more, so the exit closes at the next bar open — which on such a market is the gap after the session. Keep a positive advance there too: the deal must still be placeable before the market shuts.

Stats Panel

The exported Expert can show an on-chart stats panel.

Show stats panel — shows the on-chart position and trading stats panel in the exported Expert Advisor. Default on.

Position stats — shows the open position stats inside the on-chart stats panel. Default on.

Trading stats — shows the 1-day, 7-day, and 30-day trading stats inside the on-chart stats panel. Default on.

When protections or the news filter are enabled, the panel also lists the active protections and the upcoming news.

When changes apply

  • The values are read when you leave the MQL Export Options page, so changes affect the next Expert Advisor you export.
  • Settings are stored locally when the application closes.
  • An unreadable numeric input falls back to the previously saved value.
  • No login is required.

Reset

Use the Reset button in the toolbar to restore the MQL Export Options to their defaults.

The reset covers only this page: all other settings groups keep their values. The page form refreshes immediately.

Troubleshooting

  • The options do not change backtest results: they are included only in exported Expert Advisors, not in the in-app backtester.
  • A protection never triggers: each numeric protection is active only when higher than zero.
  • The Expert turned itself off after a loss: an account protection was reached. The Expert leaves the reason on the chart.
  • New entries are blocked with no visible reason: check the entry protections, which count the positions and volume of all Experts on the account, and the daily protection suspension, which lasts until the daily reset hour.
  • The news filter blocks nothing in the tester: the economic calendar is not read in the strategy tester. Test the news filter on a demo account.
  • Reset changed only this page: Reset restores the MQL Export Options only; other settings groups are untouched.