Vix King
- Experts
-
Lefika Raphel Sebatane
I am a young educated MQL5 developer who enjoys coding profitable strategies. I love challenges and I believe every challenge I come across is a learning curve. My coding skills speak for themselves and all my work is done professionally and outstandingly. Visit my website, www.vixalgotrading.com to - 버전: 1.73
- 활성화: 10
Download .SET files for different brokers here before testing!
1. What this EA does
The Vix King EA is a single-symbol Expert Advisor for gold (XAUUSD) that trades one specific, repeatable microstructure event: the daily session break in the gold market and the price behaviour immediately around it.
Gold does not trade 24 hours. Every broker's gold feed stops for a maintenance window once a day (the COMEX/New York close at 17:00 ET), then re-opens. Across that window the price usually moves, and the way it moves is the edge this EA harvests.
The EA is not a grid, not a martingale, not an averaging system, and it does not stack positions. It takes one position per day at most, holds it for a defined, short period, and closes it. Everything about which day, when, which direction and how big is disclosed below.
2. The edge, in full
2.1 Where the gap comes from
- Gold's daily break is anchored to the New York close (17:00 ET → 18:00 ET). In UTC that is 21:00–22:00 in US summer and 22:00–23:00 in US winter — the break moves by one hour in UTC when the US changes its clocks.
- During the break the market is closed, but the world is not. News, the Asian session open and the fixing flow land inside that hour.
- When the feed re-opens, price frequently prints higher than where it closed — the "close gap". On the brokers studied here (Exness, Deriv) the reopen prints an up-move often enough, and the EA is designed to be long the reopen
by default.
2.2 The two ways to trade it
The EA supports both, because brokers differ:
| Mode 1 — Pre-break | Mode 2 — At the open | |
|---|---|---|
| Entry | Buy a few minutes before the session end | Trade the first M1 bars after the reopen |
| Holding | Holds through the break | Never holds through the break |
| Exits | InpExitDelaySec after the first tick of the reopen | InpOpenExitBar M1 bars after the reopen |
| Fits | Brokers that close gold nightly and reopen it higher — Exness, Deriv | Brokers whose gold re-opens with a real gap and where holding across the break carries swap — Fusion Markets, IC Markets |
| Swap | Pays overnight swap on the held position | No swap (flat across the break) |
Mode 1 is the version with the long verified history. Mode 2 is the study mode:
it exposes the open-entry filters (direction, gap band, recent-high rule,
OPEN_COMBO ) so you can tune it to your own broker's reopen behaviour.
2.3 The third case — a 24/7 feed
Some feeds (e.g. a XAUUSD247m -type symbol) trade straight through the break: there is no tick pause to detect and no session time to learn. For those, the window must come from the clock. The EA detects this automatically ( BREAK_AUTO ): if the symbol's own M1 data contains no repeated daily break, the EA switches to its clock window. BREAK_CLOCK forces the clock window.
This is also the only way to validate the winter window in the Strategy Tester — see section 5.
3. How it trades, step by step
3.1 Finding the break (real symbols)
Every tick, the EA measures the pause between two consecutive ticks:
- A pause of 30 minutes or more ( InpMinGapSeconds , default 1800 s) and 3 hours or less ( InpMaxGapSeconds , default 10800 s) is a daily break.
- Anything longer (weekend, holiday, outage) is not a daily break: the EA closes any open position on the exit delay but takes no open-entry.
- The gap is measured as new bid − last bid before the pause .
The entry time is learned, not hard-coded:
- TIME_AUTO (default): the EA reads the last M1 bar before the previous break and opens the entry window InpEntryLeadMin minutes (default 3) before that time, on the same clock.
- TIME_MANUAL : use the summer/winter entry times you type in ( InpSummerHour/Min , InpWinterHour/Min , default 20:55 / 21:55), switched by US daylight saving.
3.2 The DST shift
If the broker's server clock does not follow US daylight saving, the gold break moves one hour in server time when the US changes its clocks. The EA handles this: on the first day after a US clock change it shifts the learned entry time by one hour in the correct direction. IsUSDST() implements the exact US rule (second Sunday of March 07:00 UTC → first Sunday of November 06:00 UTC).
3.3 Entry
- Only inside the entry window ( InpEntryWindowMin minutes wide).
- Spread filter: skip while the spread is wider than InpMaxSpreadPoints .
- Day filter: Mon–Fri toggles ( InpFri off by default — Friday's break is the weekend close; check your broker's triple-swap day).
- Optional up-gap filter ( InpOnlyAfterUpGap ): only trade when the previous break's gap was up. This is the strongest single filter in the study and is on by default in the Exness and Deriv presets.
- Session guard ( InpSessionGuard ): the entry time must fall inside a session the broker actually trades, otherwise the terminal answers "market closed". The guard clamps the entry into the tradable session, or hands the day to the
reopen entry. - Market-closed handling ( InpOnMarketClosed ): if the server still answers 10018 market closed at the pre-break entry, the EA can retry the day from the reopen instead of losing it.
3.4 Exit
- Mode 1: close InpExitDelaySec seconds (default 120 s) after the first tick of the reopen.
- Mode 2: close after InpOpenExitBar M1 bars from the reopen bar.
- Safety exit: close after InpMaxHoldMinutes (default 240 min) if no reopen was ever detected.
- Optional InpSLPoints / InpTPPoints (default 0 = none).
Disclosure: a stop loss cannot protect a position across the closed hour,
because there is no market to trigger it in. A violent reopen can therefore
lose more than a stop would allow. The EA prints this warning at start-up.
3.5 The open-entry study (Mode 2)
For Mode 2 the EA offers a small research toolkit so you can fit it to your feed:
- Direction ( InpOpenDir ): always long, always short, "open versus recent high", or OPEN_COMBO .
- Gap band ( InpOpenGapMinPoints / InpOpenGapMaxPoints ): keep only the gap sizes that behave.
- Recent-high lookback ( InpOpenHighLookback , 60 = last hour; InpOpenHighTolPoints tolerance).
- OPEN_COMBO (the trade-count lever): a down/flat gap buys, an open above the recent high sells, days that match neither are skipped.
Entry/exit bar indexes ( InpOpenEntryBar , InpOpenExitBar ) let you test every combination.
4. Broker sessions and the winter DST problem
4.1 Observed gold sessions (server time)
Recovered from the EA's own start-up prints in the Strategy Tester:
| Feed | Daily break (server time) | Session pattern | EA mode |
|---|---|---|---|
| Exness XAUUSDm | 20:58 → 22:00 (~62 min) | Sun open ~22:01; Mon–Fri 00:00–20:58 and 22:00–00:00 | Mode 1 (real pause) |
| IC Markets XAUUSD | 23:59 → 01:02 | Mon–Thu 01:02–23:59; Fri 01:02–23:57 | Mode 1 / Mode 2 |
| Fusion Markets XAUUSD | ~23:59 → 01:00 | Mon–Fri ~01:00–23:59 | Mode 2 (real gap) |
| XAUUSD247m (24/7 feed) | none (trades through) | ~24/5, no repeated daily break | Mode 3 (clock window) |
(Another gold feed was observed with a 00:00–23:00 session, i.e. a 23:00→00:00
break. Exact times always depend on the broker's server timezone and its DST
policy — always confirm on your own feed; the EA prints your sessions at
start-up.)
4.2 Why Deriv and Exness backtests will differ in the winter
This is the single most important thing to understand about back-testing this EA.
Gold's break moves one hour in UTC between US summer and US winter. Whether that shows up as a one-hour move in server time depends on whether the broker's server clock follows US DST.
The Strategy Tester applies the symbol's current session times to the whole test. So a backtest you run in summer teaches the tester that the gold break is at the summer time — and it uses that time for the winter months too. The tester therefore cannot reproduce the winter window on a real gold symbol.
What this means concretely for the two Mode-1 brokers:
- Exness XAUUSDm — the tester prints the break as 20:58 → 22:00 (the current, October/summer schedule) and uses it for January and February as well. In reality the winter break sits at 21:58 → 23:00, one hour later. So:
- A backtest run today places the winter entries at the summer time. Any winter trade the tester shows happened at a clock time the market was actually still open in the summer schedule, and the EA's real winter entry (21:55) is not what the tester tested.
- The winter portion of an Exness backtest is therefore not a faithful forecast of live winter behaviour — it is optimistic about the timing.
- Deriv XAUUSD — same mechanism. Deriv's gold feed closes nightly (Mode 1), and the same one-hour summer/winter shift applies. The Deriv preset turns on InpOnlyAfterUpGap and a 300-point spread cap precisely because Deriv's reopen spread is wide and its gap direction matters.
How the EA proves the winter window anyway: on the 24/7 clock feed ( XAUUSD247m ) the window comes from the clock, not from the session, so the DST switch is explicit and testable. The recovered tester run shows it switching at exactly the US boundary:
Winter (2025.12.12 – 2026.03.06): session end 21:58, reopen 23:00 (server time) Summer (2026.03.09 – ... ): session end 20:58, reopen 22:00 (server time)
The change happens on the first session after the second Sunday of March (8 Mar 2026). This is the same one-hour shift, isolated from the broker session problem. That is why the 24/7 clock feed exists in the package: it is the only
place the winter window can be validated cleanly.
Practical rule for you: run the backtest, then read the winter months with the caveat above; and re-run the EA in the winter (or on a 24/7 clock feed) before trusting the winter leg. The EA's InpClockUseDST / InpClockWinter* inputs let you encode the winter window explicitly.
4.3 The fee/quality differences between brokers
- Spread: Exness and Deriv re-open wide (hence the 300-point cap and the 60–180 s spread-wait in the presets); Fusion Markets and IC Markets re-open tighter (60-point cap).
- Swap: Mode 1 holds across the break and pays the overnight swap (Exness XAUUSD swap long is negative). Mode 2 avoids it.
- Triple-swap day: check your broker — the Wed column is a reminder in the inputs.
- Tick quality: real-tick availability varies (the tester log for XAUUSD247m reported real ticks absent for 662 minutes of 444,779 and whole days discarded). Prefer real ticks for live-fidelity numbers and M1 OHLC for long ranges.
6. Recommended settings (presets shipped)
| Preset | Symbol | Mode | Key inputs |
|---|---|---|---|
| VixKing_Exness_XAUUSDm.set | XAUUSDm | Mode 1 | up-gap filter ON, spread 300, deviation 50, retry-at-open |
| VixKing_Deriv_XAUUSD.set | XAUUSD | Mode 1 | up-gap filter ON, spread 300, deviation 50, retry-at-open |
| VixKing_FusionMarkets_XAUUSD.set | XAUUSD | Mode 2 | OPEN_COMBO , lookback 60, spread 60, deviation 30 |
| VixKing_ICMarkets_XAUUSD.set | XAUUSD | Mode 2 | OPEN_COMBO , lookback 60, spread 60, deviation 30 |
| VixKing_XAUUSD247m_clock.set | XAUUSD247m | Mode 3 | clock window, spread 3000, deviation 50 |
7. Why it belongs in a portfolio
- Different clock, different edge. Most EAs trade the London/New York trend session. This one trades a session-boundary event that is almost orthogonal to intraday trend systems — the returns come from a microstructure that most systems ignore.
- Low exposure. One position per day, held for minutes-to-hours, closed by design. It is not in the market most of the time.
- Mode-1 and Mode-2 cover two broker types. You can run the pre-break mode on a nightly-closing feed and the open mode on a 24h-ish feed, so the same logic can run across more than one account.
- Correlation tool. Because it only fires once a day around the gold break, its equity curve tends to be flat while trend systems are working and active when they are quiet.
- Transparent. Every input is documented, the log explains every decision, and the sizing maths is printed for your account.
8. Run it on a VPS — this is not optional
The edge lives in a specific few minutes around your broker's gold break, and it depends on the tick that ends the pause:
- If your PC sleeps, hibernates, updates Windows or loses the connection at the break, the EA misses the day — and possibly the reopen exit.
- The entry window is only InpEntryWindowMin minutes wide (default 3). A single dropped connection can lose it.
- The reopen spread check and the "first tick after the pause" detection both need a continuously connected terminal.
Use a low-latency VPS located near your broker's server (or MetaQuotes' hosting), with the terminal running 24/5, auto-trading enabled, and the chart left on the gold symbol. A VPS is part of the strategy, not a nice-to-have.
9. Risk disclosure
Trading gold carries substantial risk. This EA implements the logic described above; it does not guarantee profit and past results do not indicate future performance. The daily-break strategy depends on your broker's session times, spread behaviour and DST policy, all of which vary. A stop loss cannot protect a position across the closed hour, so a bad gap can lose more than a planned risk.
Test on a demo account on your own broker and your own feed before using real money.
