The Overnight Cost of Running a Gold EA

The Overnight Cost of Running a Gold EA

25 November 2026, 00:00
Lee Kai Lun
0
6

Imagine checking your gold EA on Monday morning. The open basket has barely changed in price since Friday, yet its total result looks less attractive than you expected.

Your robot has not necessarily developed expensive weekend hobbies. It may simply have held positions across a financing rollover.

Swap is an overnight adjustment that can add to or subtract from a trade's result. For an EA that regularly carries XAUUSD positions for several sessions, it deserves a place in the strategy's cost model, not just a passing glance at the broker's website.

The price target has a roommate

Suppose an EA opens four gold buy positions of 0.10 lot each. Its exit logic waits for a combined price-based profit of 10 dollars.

For this hypothetical USD account, assume the broker explicitly charges 5 dollars per lot for a normal buy-side rollover. Total volume is 0.40 lot. One ordinary rollover costs 2 dollars. If a later rollover has a multiplier of three, it costs another 6 dollars, assuming the positions and rates stay unchanged.

The basket finally reaches its 10-dollar price-based profit target. After those two financing adjustments, only 2 dollars remains before any separate commissions or other fees.

The market reached the target. The cost model did not get the invitation.

These figures are invented for illustration. They are not a broker quote, a standard gold swap rate or a forecast.

The number in Specification is not necessarily money

Open Market Watch in desktop MT5, right-click the exact symbol your EA uses and select Specification.

Check the long and short swap values, calculation mode and rollover schedule. Inspect XAUUSD with its actual broker suffix if it has one. A similarly named symbol on another account may have different contract terms.

The calculation mode tells you how to interpret the quoted values. A rate expressed in points cannot simply be multiplied by lots and labelled dollars. A percentage-based rate also needs the appropriate calculation basis. Currency conversions may matter.

Buy and sell financing terms can differ. Some positions may receive a credit, but that credit does not make their market exposure safe. Even a swap-free account can have alternative holding charges under its terms.

The day your calendar forgot

A rollover multiplier can account for days on which the market does not normally trade. Do not hardcode Wednesday as triple-swap day for every instrument. Check the symbol's weekday multipliers and the broker's rollover time, including special holiday arrangements.

An EA that opens before midnight on your laptop has not necessarily entered before the broker's rollover. Local time and server time are different clocks.

This matters when testing holding-period filters. A rule such as “never hold for more than 24 hours” does not necessarily prevent a rollover charge.

Give the EA something useful to log

MQL5 exposes the symbol's financing configuration. Here is a small read-only script to inspect the current chart symbol:

void OnStart()
{
   double buy_swap, sell_swap;
   long mode, triple_day;
   if(!SymbolInfoDouble(_Symbol, SYMBOL_SWAP_LONG, buy_swap) ||
      !SymbolInfoDouble(_Symbol, SYMBOL_SWAP_SHORT, sell_swap) ||
      !SymbolInfoInteger(_Symbol, SYMBOL_SWAP_MODE, mode) ||
      !SymbolInfoInteger(_Symbol, SYMBOL_SWAP_ROLLOVER3DAYS, triple_day))
   {
      Print("Could not read swap configuration.");
      return;
   }
   PrintFormat("%s | mode=%s | long=%g | short=%g | 3-day=%s",
               _Symbol, EnumToString((ENUM_SYMBOL_SWAP_MODE)mode),
               buy_swap, sell_swap,
               EnumToString((ENUM_DAY_OF_WEEK)triple_day));
}

This reports configuration, not a guaranteed currency cost. It sends no orders. Check all weekday multipliers and the broker formula separately before implementing a cost estimator. Current settings are not proof of what the broker charged months ago.

For open positions, POSITION_SWAP can help an EA inspect accumulated swap. For closed trades, review the associated history and relevant financing or fee entries. Avoid counting the same adjustment twice when combining open-position and historical data.

Test the exit, not just the entry

Review how your EA defines success. Does its basket target measure price profit alone or the result after financing and commissions? Is the distinction documented? How does the logic behave when holding costs increase?

In Strategy Tester, inspect the cost assumptions and report rather than assuming historical financing exactly matches today's conditions. Compare results under different holding durations and plausible cost assumptions. A controlled demo test can also help reconcile expected rollover adjustments with the terminal's recorded values, although live account terms may differ.

There is no universal instruction to close everything before rollover. An early exit may interrupt a strategy and introduce additional spread or execution costs. Treat that choice as a testable rule, not an automatic improvement.

Before trusting an overnight system, check four things:

  • The actual long and short rates and their units.
  • The broker's rollover schedule and special multipliers.
  • Whether the EA's exit calculation includes relevant costs.
  • Whether recorded adjustments agree with the assumptions used in testing.

A strategy can survive a quiet market and still find its margin for error shrinking through costs. Your EA does not need sleep, but its accounting needs to stay awake.