LAMPLIGHTER - user manual
Version 1.04 - XAUUSD - MetaTrader 5
The Lamplighter walks the same round on gold every day and lights four lamps, each at its hour. He lights the first when the morning range is drawn, the second when London opens, the third where a swing level gives way and the fourth where price comes back to a recent extreme. Every lamp has a stop loss. When the street is too quiet he leaves a lamp dark, and when the lamps keep blowing out he turns two of them down.
This manual is written for someone who has never run an expert advisor before. If you only read one chapter, read chapter 3a: it says what a small account can expect.
1. What it does, in plain words
Lamplighter is four small strategies on one gold chart. Each is a "lamp": it acts at its own time or at its own level, and has its own stop loss, its own orders and its own magic number. They share no positions and no stops.
| Lamp | Strategy | What it watches | When it acts | How a trade ends |
|---|---|---|---|---|
| 1 | Morning Breakout | the range of the early session | 06:05 server time: a buy stop above the range, a sell stop below it; when one fills the other is cancelled | stop loss at a fixed percentage of price; breakeven once the trade has moved by the size of the session range, then the stop follows price; closed at 17:55 server time if still open |
| 2 | London Open | the overnight range | 09:55 server time: a buy stop and a sell stop around the range | stop loss at the middle of the range, target the full range; once in profit the stop locks most of the best profit reached |
| 3 | Swing Breakout | the nearest unbroken 1-hour swing high above price and swing low below it | continuously: one stop order on each side | stop loss at a fixed percentage of price; the stop follows price once the trade is ahead; an early false-breakout exit closes a trade that does not follow through within minutes |
| 4 | Pullback | a 4-day high and a 4-day low | once a day, early in the server day, on days when the extreme qualifies | stop loss at a fixed percentage of price; the stop follows price once the trade is ahead |
A swing is an hourly bar whose high or low is more extreme than the bars on both sides of it. "Unbroken" means no later hourly bar has traded through it.
Every order and every position carries a stop loss from the moment it exists. Each order also carries a take profit; its distance is part of the strategy and is not an input. There is no grid, no martingale and no averaging into a losing position: a losing trade is closed at its stop and nothing is added to it. The product contains no grid or martingale code at all; it is not switched off, it is not there.
Normally each lamp holds one position. Swing Breakout and Pullback rest one order on each side, so in a whipsaw each of them can end up holding a buy and a sell together. Up to six positions can therefore be open at once; in the backtests the most open at one time was four (backtest, MetaTrader 5 Strategy Tester, real ticks).
Lamplighter needs a hedging account. The four lamps keep separate positions, and two of them can hold a buy and a sell on gold at the same time. A netting account (one position per symbol) would merge them into one. Chapter 2 says more.
Server time. All session times are broker server times, for a server on GMT+2 in winter and GMT+3 in summer. If your broker's clock is different, chapter 10 shows the three inputs that move the strategies to the right moments.
What keeps a lamp dark or turns it down. All of these are on by default, and each shows on the panel (chapter 5):
- Quiet-market protection. Morning Breakout sits out a day when the recent daily range is small compared with price. London Open sits out the days when gold's recent range is in the quietest third of its own past year.
- Wide range. London Open stands aside on a day when the overnight range is so wide that a stop at its middle would risk too much of price.
- News guard. Around a high-impact US dollar release, resting orders are taken off and no new ones are placed, from 10 minutes before to 10 minutes after.
- Spread guard. A new order waits while the spread is above the limit, and resting orders are taken off while the spread blows out against its normal.
- Steady mode. When the range breakouts of the last weeks have kept failing, Morning Breakout and London Open trade at half size until breakouts hold again.
2. Installation (five minutes)
- If you bought Lamplighter from the Market, it appears in the Navigator under Market. If you have the file, open MetaTrader 5, File -> Open Data Folder, open
MQL5\Expertsand copyLAMPLIGHTER.ex5there; then right-click the Navigator panel and choose Refresh. - Open a gold chart on a hedging account:
XAUUSD,XAUUSD+,XAUUSDp,GOLD.proor whatever your broker calls spot gold against USD. Any timeframe works; the strategies read their own bars. - Drag LAMPLIGHTER onto the chart. On the Common tab tick Allow Algo Trading. On the Inputs tab only section 1. Start here needs you (chapter 2a); the defaults are meant to be run as they are. Click OK.
- Make sure the Algo Trading button in the toolbar is green. A smiling face in the top-right corner of the chart means the EA is running.
- Check your broker's clock (chapter 4, step 2).
The journal (Toolbox -> Experts) shows one line on start, for example:
LAMPLIGHTER v1.04 | Symbol=XAUUSD TF=PERIOD_M15 | S1=1 S2=1 S3=1 S4=1 | magics 89860..89863 | GMT=off shift=0 | risk RISK_MEDIUM | account stop 50.0% | quiet-market protection 1.20%
It names the symbol and chart timeframe, which of the four strategies are on (1 = on), the four magic numbers, whether the broker-clock adjustment is on and by how many hours it shifts the session times right now, the risk level, the account stop in percent below the starting balance and Morning Breakout's quiet-market threshold in percent of price (a zero in either place means that protection is off).
Account type: hedging. A hedging account lets one symbol hold several positions at once, including a buy and a sell together. Lamplighter needs that: on a netting account the positions of the four lamps would merge, and a stop or an exit would no longer belong to the lamp that opened the trade. The EA does not check the account type for you. If you are not sure which type you have, ask your broker before you attach it.
Gold only. On a live or demo chart of a symbol that is not gold, the EA places no orders and says so in the Experts tab. The input Allow live trading on a non-gold symbol lets it trade there at the broker's minimum lot; the strategies were built and tested on gold only.
2a. The inputs at a glance
The Inputs tab is ordered by how often you should touch it. Most users change only section 1.
| Section | What it holds | Touch it? |
|---|---|---|
| 1. Start here | Risk level, the account stop and its starting balance, Maximum spread | yes - this is the whole setup |
| 2. Strategies | switches for the four lamps, and the two quiet-market protections | rarely |
| 3. When not to trade | steady mode, the news guard, the spread blow-out guard | rarely |
| 4. Broker clock | the session-time adjustment for a server that is not on GMT+2 / GMT+3 | only if your broker's clock differs |
| 5. Custom sizing | a fixed lot, or a balance per 0.01 lot, and the maximum lot per order | only with Risk level = Custom |
| 6. Trading | magic number base, order comment, trading on a non-gold symbol | a second chart needs its own magic number |
| 7. Panel and chart | the control panel, the order and stop drawings, the text size | cosmetic |
Maximum spread is in price units; for gold that is dollars. A new order waits while the spread is wider (chapter 6).
Account stop closes everything and stops the EA when the account's equity falls the set percentage below your starting balance. The account stop chapter explains it.
3. The only setting that matters: risk level
InpRisk is one choice: Low, Medium (the default), High, Hot or Custom. It sets the lot per order from your balance:
| Level | Lot rule | Smallest balance for this level |
|---|---|---|
| Low | 0.01 lot per 4,000 of balance | 4,000 |
| Medium (default) | 0.01 lot per 2,000 of balance | 2,000 |
| High | 0.01 lot per 1,000 of balance | 1,000 |
| Hot | 0.01 lot per 500 of balance - the minimum account, the deepest dips; for experienced users, with risk capital only | 500 |
| Custom | a fixed lot, or a balance per 0.01 lot of your own (section 5 of the Inputs tab) | - |
The lot grows one step (0.01 on a broker whose lot step is 0.01) for every whole block of the balance, and never falls below the broker's minimum. What that means in lots:
| balance | Low | Medium | High | Hot |
|---|---|---|---|---|
| 500 | 0.01 | 0.01 | 0.01 | 0.01 |
| 1,000 | 0.01 | 0.01 | 0.01 | 0.02 |
| 2,000 | 0.01 | 0.01 | 0.02 | 0.04 |
| 5,000 | 0.01 | 0.02 | 0.05 | 0.10 |
| 10,000 | 0.02 | 0.05 | 0.10 | 0.20 |
| 20,000 | 0.05 | 0.10 | 0.20 | 0.40 |
Below the smallest balance of the level you chose, the EA trades the broker's minimum lot, so the dips take a larger share of the account (chapter 3a). The lot is the same for all four strategies, except that steady mode halves it for Morning Breakout and London Open while it acts (chapter 6). The Maximum lot per order input (5.0 by default) caps every single order at every level; it does not cap the total of open lots.
This is a lot per balance, not a risk percentage. The stops are a percentage of price (or a share of a measured range), so one stop on a given lot costs more when gold is expensive. The panel's Risk now line shows what every open stop would cost in your account currency (chapter 5).
What the testing showed at each level. Each level was run with every other input at its default, starting from the smallest balance made for it, over the whole window of each broker. Backtest, MetaTrader 5 Strategy Tester, real ticks, version 1.03 (version 1.04 makes the same trades), 150 ms execution delay; BlackBull 2022-11-01 to 2026-10-09 (includes the quiet 2023 gold market), Vantage 2025-07-04 to 2026-10-09.
| Level, starting balance | Lowest equity, as a share of the start (BlackBull / Vantage) | Deepest fall below a running high (BlackBull / Vantage) | Profit factor (BlackBull / Vantage) |
|---|---|---|---|
| Low, 4,000 | 95 % / 97 % | 8.5 % / 7.1 % | 1.55 / 1.66 |
| Medium, 2,000 | 91 % / 95 % | 16.3 % / 11.7 % | 1.58 / 1.62 |
| High, 1,000 | 82 % / 90 % | 30.3 % / 18.6 % | 1.53 / 1.58 |
| Hot, 500 | 64 % / 80 % | 52.8 % / 41.5 % | 1.54 / 1.52 |
"Lowest equity" is the lowest the account's equity (balance plus open profit and loss) went, as a share of the money it started with: 64 % means a 500 account went as low as about 320 before it grew (BlackBull, 2022-11 to 2026-10, the backtest above). "Deepest fall below a running high" is the report's relative equity drawdown: the largest drop from a high point the account had reached, in percent of that high. In none of these runs did the account fall to the account stop (fifty percent below the start).
Higher levels grow the account faster in a good market and cut it deeper in a bad one. There is no level that avoids that trade-off. Choose the level whose dips you could sit through (chapter 3a).
Custom sizing
Set Risk level = Custom, then either: - Fixed lot - leave "Sizing" on Fixed lot and give the lot in "Fixed lot" (0.01 by default), or - Scale with balance - set "Sizing" to Scale with balance and give the balance per 0.01 lot (2,000 by default).
3a. Minimum balance - read this if your account is small
The minimum is 500, at Risk level Hot. From a start of 500 the account survived in every test: on BlackBull, over a window that includes the quiet gold market of 2023, its equity went as low as 64 % of the starting balance before it grew; on Vantage (2025-07 to 2026-10) as low as 80 %. The account stop, fifty percent below the start, was never reached. In the most recent stretch tested, 2026-09-01 to 2026-10-09, a 500 account at Hot never closed a day below its starting balance on either broker, and its equity went no lower than 96 % of it. Backtest, MetaTrader 5 Strategy Tester, real ticks, version 1.03 (version 1.04 makes the same trades) at its defaults with Risk level Hot, 150 ms execution delay.
The recommended start is 2,000, at the default Medium level. It is chosen for a fall of no more than about twenty percent: from 2,000 at Medium the deepest fall below a running high was 16.3 % on BlackBull (including 2023) and 11.7 % on Vantage, and the equity went no lower than 91 % of the start. From 1,000 at High the deepest fall was 30.3 % on BlackBull, from 500 at Hot 52.8 %. The table in chapter 3 has every level.
Why the small account dips deeper: below its level's balance, and at Hot from the start, the EA trades the broker's minimum lot, and a minimum-lot stop is a larger share of a small balance. Steady mode cannot help there either: half of the minimum lot is still the minimum lot, so steady mode starts to act once the lot is 0.02 or more.
The broker's margin is the second limit. One 0.01 lot of gold is one ounce on a broker with a 100-ounce lot, and its margin is the gold price divided by your leverage. At leverage 1:30 (the EU retail limit for gold) and gold near 4,100, one 0.01 position needs about 137 of margin. Up to six positions can be open at once, because Swing Breakout and Pullback can each hold a buy and a sell at the same time, next to one position each for Morning Breakout and London Open; six positions need about 820. In the backtests the most open at one time was four, about 550 (backtest, MetaTrader 5 Strategy Tester, real ticks). On a 500 account at 1:30 a full set of positions cannot be carried: the later orders are not sent. Before it sends an order the EA checks that your free margin covers the order plus a 10 % buffer; an order that fails the check is not sent, and the Experts tab says why (chapter 8). At leverage 1:500 the same position needs about 8.
The account stop on a small account is measured from the money you started with (chapter 3b), so profit made along the way never counts against you: an account that grows from 500 to 900 and falls back to 600 is still above its start, and the stop does not act.
Choose the balance for the dip you could sit through, not for a good month.
3b. The account stop
InpAccountDDPct (50 by default, 0 = off) and InpStartBalance (0 by default).
- The EA remembers your starting balance: the balance when it first starts on the account, or the figure you enter in Starting balance for the account stop.
- When the account's equity (balance plus open profit and loss) is the set percentage or more below that starting balance, the EA closes all of its trades, deletes all of its orders and stops. The panel's status word reads Stopped, and the journal says:
LAMPLIGHTER: account drawdown stop reached - every trade closed, the EA stopped. - The default of fifty percent is the line below which the account is no longer the account you started. Set it tighter if you prefer.
- Profit made since the start does not count against you: the stop looks at the money you started with, not at the best day.
- It measures the whole account's equity, so losses on other EAs or by hand count toward it; it closes only this EA's trades.
- It keeps its state through a terminal restart. On a live account the EA saves the starting balance and whether the stop has acted; after a restart the panel still reads Stopped, and the journal line
restart: saved state restoredends withaccount drawdown stop TRIPPED - press Resume to clear it. - Resume clears it. Press Resume on the panel: the starting balance restarts at the current equity and each lamp places again at its next check. If the left button still reads Pause after the stop acted, press it once; it then reads Resume. The buttons are part of the panel, so keep Show the control panel (
InpPanel) switched on. - Taking the EA off the chart forgets the saved state; attaching it again starts with today's balance as the new start (or the figure you enter).
- 0 switches the stop off: nothing is closed by the account rule.
- It is a guard, not a guarantee: a price gap can carry the loss past the line before the closing orders fill.
4. Your first week
- Run it on a demo account first, same broker and same settings, for at least four weeks. Nothing in this manual replaces watching it on your own broker's prices.
- Check the clock on the first morning. The Morning Breakout orders should appear at 06:05 on the server clock shown in Market Watch, and the London Open orders at 09:55. If they appear at another time, your server is not on GMT+2 / GMT+3: see chapter 10.
- Each day, glance at the panel (chapter 5): which lamps lit, which stayed dark and why (the guard strip says), and what Risk now reads before and after a fill.
- Expect days with no trade at all and weeks where only one or two lamps lit. That is the guards working.
- When you go live, use the level that fits your balance (chapter 3 and 3a) and raise the level only after the first weeks match what you saw on demo.
5. Reading the chart, the panel and the journal
Nothing is drawn in a plain Strategy Tester run. On a live chart and in the visual tester the panel and the drawings refresh every second.
5.1 The panel (InpPanel, on by default)
A small panel sits in the top-left corner.
| Part | What it tells you |
|---|---|
| Lamplighter + a status word | Trading, Paused (entries paused from the panel), Closed (the market is closed), Algo off (Algo Trading is switched off, so the EA cannot place or manage orders) or Stopped (the account stop acted) |
| Morning, London, Swing, Pullback rows | one dot and one word per lamp: the time of the next setup (06:05, or Mon 06:05 over a weekend), done today, 1 order / 2 orders waiting, BUY +12.40 or SELL -3.10 for an open trade (your account currency), quiet day, wide range, watching, closed, paused or off. Hover for the detail. |
| Guard strip: News, Spread, Quiet, Steady | four chips, always visible. News, Spread and Quiet are dim when idle and light up gold while the guard acts: News around a high-impact USD release, Spread while the spread is above the limit or blows out, Quiet while a lamp stands aside for the day (a quiet market or a range too wide for its stop). Steady is green while steady mode is on and watching, and gold while it acts (Morning Breakout and London Open at half size, or standing aside if you chose that). Hover over a chip for the detail. |
| Risk now | the money at the stops: none, or -45.20 if filled (no open trade; what the resting orders could cost if they filled and were stopped), or -30.10 (0.3%) (what every open stop would cost, and that as a share of the balance), or locked +12.00 (every open stop is already past its entry) |
| Account | a bar showing how far the account stands below your starting balance against the stop level, with the number beside it, for example 3.1 / 50% |
| Today / 7 days | this EA's closed result for today and for the last seven days, after costs (its own magic numbers only) |
| Pause / Close all | the two buttons below |
| Button | What the EA does | Clicks |
|---|---|---|
| Pause / Resume | Pause: deletes the resting orders and places no new ones; open trades keep being managed. The pause is saved and survives a restart. Resume: each lamp places again at its next check. Resume also clears a tripped account stop; the starting balance then restarts at the current equity. | one |
| Close all | closes every Lamplighter trade at market, deletes its resting orders and pauses new entries, so nothing new appears after it. The left button then reads Resume; press it when you want entries again. | two |
"Two clicks": the first click turns the button red and reads Confirm?; a second click within 5 seconds acts. Every panel action is sent by the EA itself, so your account history shows it as an Expert deal, and each one is written to the Experts tab. Algo Trading must be on for the buttons to work.
5.2 What Lamplighter draws on the chart (InpDrawOrders, on by default)
- Resting orders: a dotted line at each order's price, with a label at the right edge of the chart such as
Morning buy 4210.50, in blue for a buy and orange for a sell. - Open trades: a dashed gold line at the trade's current stop. Hover over it to read the strategy and what that stop does:
stop -30.10(it would lose that much),stop at entry, orstop keeps +12.00(it would still lock that much). The line moves as the stop follows price. - A day without a trade: a small note at the lamp's time when a guard kept it out,
quiet day - no Morning tradeorwide range - no London trade.
The order and position lines with their stop loss and take profit are MetaTrader's own (switch on Show trade levels in the chart properties if you do not see them). Turning the drawings off changes nothing in the trading.
5.3 Journal lines
| Line | Meaning |
|---|---|
LAMPLIGHTER v1.04 \| Symbol=... \| ... |
started (chapter 2) |
restart: saved state restored (today's placements, range, locks) |
the EA started and found the state it saved earlier (see what is saved, below). If the account stop had acted, the line ends account drawdown stop TRIPPED - press Resume to clear it. |
note: the four strategies are built and tested on gold (XAUUSD) - on ... the EA places no orders (allow it in the settings to trade the minimum lot) |
the chart is not a gold symbol (chapter 2) |
news guard: high-impact USD release at 15:30 - no orders from 10 min before to 10 min after |
the news guard is about to act (chapter 6) |
news guard: MT5 calendar on - 2 tier-1 USD release(s) in the next 2 days |
the news guard reads your terminal's economic calendar; if the calendar does not answer, it says so and uses the release table stored in the EA |
spread guard: spread 2.40 (normal 0.30) - resting orders parked until it calms |
the spread blew out; resting orders are off until it calms |
LAMPLIGHTER panel: ... |
a panel action and its result, for example entries paused - resting orders removed; open trades are still managed, or account stop cleared - its reference restarts at today's equity |
LAMPLIGHTER: account drawdown stop reached - every trade closed, the EA stopped |
the account stop acted (see the account stop chapter) |
safe trade layer: ... - request not sent (shown once a day) |
the EA held back a request that the server would have refused, and says why (chapter 8) |
an order error line with the broker's reason, for example no money |
the broker refused an order that the checks of chapter 8 could not foresee |
6. When it does not trade - and why that is usually right
| Situation | What happens | Setting |
|---|---|---|
| Quiet market: the recent daily range is small compared with price | Morning Breakout sits out the day; the Quiet chip lights | Quiet-market protection, Morning Breakout (0 = off) |
| Quiet market: gold's recent range is in the quietest third of its own past year | London Open sits out the day; the Quiet chip lights | Quiet-market protection, London Open (on / off) |
| London Open's range is too wide for its stop | London Open stands aside for the day; the Quiet chip lights, the London row reads wide range |
none - part of the strategy |
| Range breakouts keep failing | the share of recent Morning and London range breakouts that held, over the last 15 trading days, is in the lowest third of its own past year: Morning Breakout and London Open trade at half size until it recovers; the Steady chip turns gold | Steady mode (Off / Half size / Stand aside) |
| A high-impact USD release is due | from 10 minutes before to 10 minutes after, resting orders are taken off and no new ones are placed; the News chip lights | News guard, News minutes |
| Spread above the limit | a new order waits; Morning Breakout and London Open try again until about two hours after their time, then skip the day | Maximum spread |
| Spread blows out (four times its normal of the last hour, and above 1.00) | resting orders are taken off until it calms; the Spread chip lights | Spread guard, blow-out multiple, blow-out floor |
| Weekend | Morning Breakout, London Open and Pullback place orders Monday to Friday only | none |
| A lamp is switched off | it places nothing | the strategy switches |
| Paused from the panel, or Close all pressed | no new orders; open trades still managed (after Close all there are none) | the Pause / Resume button |
| The account stop acted | everything closed, the EA stopped (status Stopped) until Resume | Account stop |
| Algo Trading off, or the market closed | nothing can be placed (status Algo off or Closed) | the toolbar button |
| A request that the server would refuse (margin, volume, a stop too close to price and so on) | the request is not sent; the Experts tab says why, once a day | none - the safe trade layer, chapter 8 |
| Swing Breakout or Pullback already holds a trade on one side | no second order on that side until it closes | by design |
| The chart is not gold | no orders on a live or demo account | Allow live trading on a non-gold symbol |
Orders taken off by the news or spread guard are put back when the guard clears, at the same price, stop and target. An order whose price was crossed while the guard held, or that expired meanwhile, is not put back: the move it was waiting for happened inside the guarded minutes. Open trades are never closed by these guards; their stops stay on the broker's server.
Steady mode reads the market, not the EA's own results: for every past day it checks whether the first break of the Morning range still held at 17:55 and the first break of the London range at 15:55. It reads the five-minute bars of the last 300 trading days, which fit inside MetaTrader's default chart history ("Max bars in chart", 100,000). Right after the first start, while the terminal may still be downloading that history, it waits and tries again every five minutes; until then it does not act. Half of the broker's minimum lot is still the minimum lot, so on a small account steady mode has nothing to halve until the lot is 0.02 or more. Stand aside skips those two lamps instead of halving them: in the tests it rode slightly flatter than half size and earned clearly less.
7. Exit mechanics
A trade can end at its stop loss, at a stop that has been moved (breakeven, a lock or a trail), at its take profit, at the 17:55 close (Morning Breakout only) or at the false-breakout exit (Swing Breakout only).
- Morning Breakout. Stop loss at a fixed percentage of price. Once the trade has moved by the size of that morning's session range, the stop goes to breakeven; later the stop follows price, set again at the start of each new one-minute bar. Any Morning trade still open at 17:55 server time is closed.
- London Open. Stop loss at the middle of the overnight range, target the full range. Once the trade is in profit, the stop locks most of the best profit reached, updated on every tick.
- Swing Breakout. Stop loss at a fixed percentage of price. Once the trade is ahead, the stop follows price, set again at the start of each new one-minute bar. A few minutes after the entry the EA checks whether the trade has followed through; if it has not, the trade is closed.
- Pullback. Stop loss at a fixed percentage of price. Once the trade is ahead, the stop follows price, set again at the start of each new one-minute bar.
A stop is only ever moved in the trade's favour. The stop loss of every trade is on the broker's server; the moves described above are made by the EA, so the terminal has to be running for them.
8. Execution quality - what your broker adds
Lamplighter rests stop orders, which the broker's server fills the instant price reaches them. Two things from your broker decide how close the fills are to the plan.
- Spread. The spread is paid on every entry. A wider spread takes a larger share of each stop. The spread guards keep new orders back while the spread is wide and take resting orders off while it blows out; they do not touch open trades.
- Fills in fast markets. In the second a major data release comes out, price can jump and the spread can widen, and a stop order can fill beyond its price and a stop beyond the stop. The news guard keeps resting orders off the market around the high-impact USD releases it knows of, but an open trade keeps its stop through a release, and a release the guard does not know of is not covered. The tester's stored ticks may not contain the widest release-second spreads, so a backtest can understate this cost.
Prefer a broker with tight gold spreads and fast order execution, and a VPS close to the broker's server.
The safe trade layer
Before the EA sends any request, it checks that the broker's server would accept it. A request that would fail is not sent. The trading rules do not change: a request the server would have refused is simply not made. The checks are:
- the market is open for the symbol, and the symbol allows trading (not disabled, and not close-only for a new trade);
- the volume is inside the broker's minimum and maximum and inside the symbol's volume limit;
- free margin covers the order plus a 10 % buffer;
- the account's limit on pending orders is not reached;
- a stop order sits on the correct side of price, outside the broker's stop level and freeze level;
- a stop loss, a take profit, or a move of either, is not closer to price than the broker's stop level and freeze level.
When a request is held back, the Experts tab shows one line, safe trade layer: <reason> - request not sent (shown once a day), once a day for each kind of reason. The reason tells you whether it is the account (margin, the pending-order limit) or the broker (stop level, volume limit, market hours).
9. Sizing and margin
- The lot per order comes from the risk level and the balance (chapter 3). It is the same for all four strategies, except while steady mode halves it for Morning Breakout and London Open.
- There is no cap on the total of open lots, only on each order (Maximum lot per order).
- Margin per 0.01 lot of gold is about the gold price divided by your leverage. Up to six positions can be open at once (four at most in the backtests). Chapter 3a gives the 1:30 and 1:500 figures.
- The minimum balance is 500 at Hot; the recommended start is 2,000 at the default Medium level (chapter 3a).
- On a symbol that is not gold the EA places no orders on a live or demo account unless you allow it; allowed, it trades the broker's minimum lot whatever the risk level.
- Before every order the safe trade layer checks free margin with a 10 % buffer (chapter 8). An order that the account cannot carry is not sent, and the reason shows in the Experts tab. The EA does not shrink an order to fit.
- Use one chart per gold symbol. Two copies on the same symbol with the same magic number would manage each other's orders; a second copy needs a magic number base at least four apart.
10. Broker clock and optimising
The broker clock
The session times (06:05, 09:55 and the 17:55 close) are for a server on GMT+2 in winter and GMT+3 in summer, with the summer switch on the European daylight-saving dates (the last Sunday of March to the last Sunday of October). For any other server:
- Switch on Adjust the session times.
- Enter your server's offset from GMT in winter and in summer.
The strategies then fire at the same moments of the real day. Example: a server on GMT+0 in winter and GMT+1 in summer: enter 0 and 1. Morning Breakout is then placed at 04:05 server time instead of 06:05, which is the same real moment. A server on a fixed GMT+3 all year: enter 3 in both boxes. The start line in the journal shows the shift in use (shift=...).
Optimising (for advanced users)
Every input in the complete reference below can be searched in the Strategy Tester's optimiser. The strategy constants (the times of day, the stop distances, the breakeven and trailing rules) are fixed in the compiled product and are not inputs. Two warnings:
- The defaults are the product's configuration. A value that looks better on one quarter of history is usually curve-fitting.
- Optimise on real ticks ("Every tick based on real ticks"), never on bars: the fills depend on the tick path.
11. What is saved and what is not
On a live account Lamplighter saves its daily state in terminal global variables, and restores it when it starts again. The state is refreshed about once a second while ticks arrive, and at every Pause, Resume and account stop. A terminal restart therefore does not place a day's straddles twice and does not forget a tripped account stop. The journal says restart: saved state restored when it has done so.
- Saved and restored after a restart:
- which lamps have already placed their orders today, so a restart inside a lamp's placement hour does not place that day's orders again;
- Morning Breakout's session range, which the breakeven step measures in, so a Morning trade that is open across a restart still gets its breakeven step;
- London Open's starting risk and the best profit an open trade has reached, which its locking stop measures from;
- the account stop: the starting balance and whether the stop has acted (it stays Stopped until Resume);
- the Pause from the panel, in a terminal global variable named
LLP<magic base>_pause(LLP89860_pauseby default). - Open orders and open positions are re-adopted after a restart by their magic number.
- Not saved: orders taken off by the news or spread guard. After a restart inside a guard window, Swing Breakout and Pullback place again at their next check; a Morning or London straddle taken off that day is not placed again until the next day. Nothing is saved in the Strategy Tester; every tester run starts clean.
- Taking the EA off the chart forgets the saved state, so attaching it again starts fresh.
- The saved state is keyed by the magic number base, so two copies with different bases keep separate states (chapter 9).
12. Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| No orders at the lamp's time | a guard (check the guard strip: News, Spread, Quiet), a weekend, Paused, the lamp switched off, or a server clock that is not GMT+2 / GMT+3 | read the panel; chapter 6; chapter 10 for the clock |
| Resting orders disappeared and came back | the news or spread guard took them off and put them back | intended (chapter 6) |
| Morning or London trades are smaller than the other two | steady mode is acting (the Steady chip is gold) | intended (chapter 6); set Steady mode to Off to trade them at full size |
| Orders appear at other clock times than 06:05 and 09:55 | the broker-clock adjustment is on with an offset that differs from GMT+2 / GMT+3, so the strategies are shifted to keep the same real moments | intended if you set it; check the two offsets (chapter 10) |
| Panel shows Stopped | the account stop acted, and it survives a restart | chapter 3b; press Resume on the panel (if the button reads Pause, press it once first). Keep InpPanel on. |
| Panel shows Algo off | Algo Trading is off in the toolbar, or not allowed on the Common tab | switch it on |
| No panel in the Strategy Tester | the panel is not drawn in a plain tester run | use the visual tester, or a demo chart |
no money or a margin error in the Experts tab |
the broker's margin for the order is more than your free margin | chapter 3a: add funds or a higher leverage |
safe trade layer: ... - request not sent |
a request would have been refused by the server | the line names the reason; chapter 8 |
| No orders, and the Experts tab says the strategies are built for gold | the chart is not a gold symbol | attach it to a gold chart |
| Lot smaller or larger than expected | the lot comes from the balance in blocks (chapter 3), with the broker minimum as the floor, and steady mode halves it for two lamps while it acts | read the table in chapter 3; check Risk level and the Steady chip |
| Nothing new appears after Close all | Close all also pauses new entries | press Resume when you want entries again |
| Two charts cancel each other's orders | the same magic number base | give the second copy a base at least four apart |
| Panel covers the one-click trading buttons | both use the top-left corner | hide one-click trading (right-click the chart) or set InpPanel to false (the panel's buttons then do not exist) |
| Strategies seem to cancel each other, or a stop does not match the lamp | a netting account merges opposite positions on one symbol | use a hedging account; the EA does not check the account type itself (chapter 2) |
| Different results from the screenshots | a different broker, window or tester model | the figures are Strategy Tester runs on one broker's real ticks; chapter 14 gives the settings |
13. Final checklist and disclaimer
- [ ] Demo run of at least four weeks on your broker
- [ ] A hedging account (Lamplighter needs one)
- [ ] Broker clock checked: the Morning orders appear at 06:05 server time (or the adjustment is set)
- [ ] You have read chapter 3a and chosen a balance for the deepest dip you could sit through, not for a good month (2,000 for the default Medium level; 500 is the minimum, at Hot)
- [ ] Algo Trading enabled; a VPS or a PC that stays on (the stops are on the server, but the moving stops, the guards and the account stop need the EA running)
- [ ] You accept that a quiet, sideways gold market can mean months of flat or losing results
Disclaimer. Trading leveraged products carries a high level of risk and may not be suitable for all investors. All performance statements in this manual and its listing come from Strategy Tester runs on historical broker tick data; they are not results from live trading and do not predict future performance. Past performance is not indicative of future results. Only trade with money you can afford to lose.
14. Reproduce the tests yourself
Every figure this manual quotes comes with the settings that produced it. Reproducing one takes a few minutes in MetaTrader 5 and needs no set file. Open the Strategy Tester with Ctrl+R.
| Step | Setting |
|---|---|
| 1 | Expert: LAMPLIGHTER - the Journal's first line must read LAMPLIGHTER v1.04 |
| 2 | Symbol: gold on your terminal (state which broker and symbol the row was measured on) |
| 3 | Timeframe: any (the strategies read their own bars) |
| 4 | Date: Custom period - 2022.11.01 to 2026.10.09 (BlackBull, XAUUSDp) |
| 5 | Modelling: Every tick based on real ticks |
| 6 | Deposit: 10,000; leverage as your account; a hedging account |
| 7 | Execution delay: 150 ms |
| 8 | Inputs: leave every input at its default (Risk level = Medium) |
Expect 2,054 trades, net +98,562, profit factor 1.60 and a relative equity drawdown of 14.05 % (backtest, MetaTrader 5 Strategy Tester, real ticks, version 1.04 at its defaults (Risk level Medium), deposit 10,000, 150 ms execution delay, BlackBull). The lot grows with the balance, so most of that money was made late in the window on larger lots; the profit factor and the drawdown are the figures to compare. For the level table of chapter 3, set the deposit to the level's smallest balance and the Risk level to that level. On another broker the entries are the same and the money differs. The Journal must say "real ticks" for the whole window: a tester that fills a gap with generated ticks produces a different, invalid result.
Complete reference - every input, its set-file key and default
The Inputs tab shows the plain labels in the Meaning column; enum defaults are the source names.
| Group | Input | Type | Default | Meaning |
|---|---|---|---|---|
| 1. Start here | InpRisk |
RiskLevel | RISK_MEDIUM | Risk level (Low 4,000 / Medium 2,000 / High 1,000 / Hot 500 of balance per 0.01 lot, or Custom) |
| 1. Start here | InpAccountDDPct |
double | 50.0 | Account stop: close all and stop at this % below the starting balance (0 = off) |
| 1. Start here | InpStartBalance |
double | 0.0 | Starting balance for the account stop (0 = the balance when the EA first starts) |
| 1. Start here | InpMaxSpreadUsd |
double | 0.60 | Maximum spread to place an order (price units; gold: USD) |
| 2. Strategies | InpEnableS1 |
bool | true | Morning Breakout - early-session range, placed 06:05 server time |
| 2. Strategies | InpEnableS2 |
bool | true | London Open - overnight range, placed 09:55 server time |
| 2. Strategies | InpEnableS3 |
bool | true | Swing Breakout - nearest unbroken 1-hour swing |
| 2. Strategies | InpEnableS4 |
bool | true | Pullback - stop orders at a 4-day extreme |
| 2. Strategies | InpS1MinRangePct |
double | 1.2 | Quiet-market protection: Morning Breakout sits out below this % daily range (0 = off) |
| 2. Strategies | InpS2QuietGate |
bool | true | Quiet-market protection: London Open sits out the quietest third of gold's own year |
| 3. When not to trade | InpFtMode |
SteadyMode | STEADY_HALF | Steady mode: when range breakouts keep failing, Morning / London trade smaller (Off / Half size / Stand aside) |
| 3. When not to trade | InpNewsGuard |
bool | true | News: park orders and place none around high-impact USD releases |
| 3. When not to trade | InpNewsMinutes |
int | 10 | News: minutes before and after the release |
| 3. When not to trade | InpSpreadGuard |
bool | true | Spread: park orders while the spread blows out |
| 3. When not to trade | InpSpreadGuardX |
double | 4.0 | Spread: blow-out = this x its normal (last hour) |
| 3. When not to trade | InpSpreadGuardMinUsd |
double | 1.00 | Spread: ... and wider than this (price units; gold: USD) |
| 4. Broker clock | InpUseGMTOffset |
bool | false | Adjust the session times (off = broker on GMT+2 winter / GMT+3 summer) |
| 4. Broker clock | InpGMTWinter |
int | 2 | This broker's server offset from GMT, winter |
| 4. Broker clock | InpGMTSummer |
int | 3 | This broker's server offset from GMT, summer |
| 5. Custom sizing (Risk level = Custom) | InpLotMode |
LotMode | LOT_FIXED | Sizing (Fixed lot / Scale with balance) |
| 5. Custom sizing (Risk level = Custom) | InpFixedLot |
double | 0.01 | Fixed lot |
| 5. Custom sizing (Risk level = Custom) | InpBalancePer001 |
double | 2000 | Balance per 0.01 lot (Scale with balance) |
| 5. Custom sizing (Risk level = Custom) | InpMaxLotCap |
double | 5.0 | Maximum lot per order (every risk level) |
| 6. Trading | InpMagicBase |
int | 89860 | Magic number (the four strategies use this + 0, 1, 2, 3) |
| 6. Trading | InpComment |
string | LL | Order comment |
| 6. Trading | InpAllowOtherSymbols |
bool | false | Allow live trading on a non-gold symbol (minimum lot) |
| 7. Panel and chart | InpPanel |
bool | true | Show the control panel (status, strategies, guards, Pause / Close all) |
| 7. Panel and chart | InpDrawOrders |
bool | true | Draw resting orders and each trade's live stop on the chart |
| 7. Panel and chart | InpTextSize |
int | 10 | Text size of the panel and chart labels (8-16) |