TWAP Institutional
- Experts
- Versione: 4.4
- Attivazioni: 5
TWAP Institutional
A gold trend-pullback Expert Advisor. Every position it opens carries a hard, broker-side stop-loss and a dollar risk that is fixed BEFORE the order is sent.
Developed and measured on XAUUSD H1. It is a gold strategy, not a generic one: on the same broker and window it returns a profit factor of 1.43 on XAUEUR and LOSES money on XAGUSD (PF 0.94, 35% drawdown). Re-test before running it on anything else.
WHAT THE CURRENT BUILD MEASURES
IC Markets XAUUSD H1, 2023.03.20 - 2026.09.01, 10,000 USD, 1% risk per trade, 1-minute OHLC, shipped defaults:
- Net profit +19,493
- Profit factor 2.14
- Sharpe ratio 4.04
- Worst relative equity drawdown 10.3%
- 319 trades
- Expectancy +0.51 R per basket, profit factor in R 2.24
Eight independent half-year windows on the same settings - seven profitable, one not: +116, +1,353, +2,102, +1,952, +984, +1,250, +1,413, -430.
HOW THE TRADES ACTUALLY END
Of 201 completed baskets, every exit tagged by the EA itself and counted in R - the risk taken on that trade:
- 83 full stops at -1.00 R
- 31 breakeven scratches at +0.13 R
- 78 trailed out in profit at +1.63 R
- 9 take-profit caps at +6.00 R
59% of trades reach +1R and lock the stop at breakeven. Average win +2.09 R.
HOW IT TRADES (shipped defaults)
- Entry: a Connors RSI(2) pullback in the direction of the EMA 20/50 trend state, filtered by an EMA200 slope gate, a session guard, and a weighted 7-timeframe moving-average agreement gate (M5, M15, M30, H1, H4, D1, W1). The score in the signal's direction must reach 0.50, and at least 5 of the 7 timeframes must be readable or the EA refuses to trade. This gate does most of the work - with it switched off the strategy has no measurable edge on our data.
- Initial risk (1R) = 3.0 x ATR(14), frozen at entry and attached to the order itself as a real broker-side stop-loss, so it survives a disconnect or a platform restart.
- At +1R the stop moves to breakeven +0.1R, and at the same moment the EA opens a SECOND position at 50% of the base lot (InpUsePyramid, ON by default). Peak exposure is 1.5x the base lot on a hedging account; on a netting account the legs merge. Both rest on the same stop. This is leverage and it carries real risk - set InpUsePyramid=false for strictly one position at a time.
- From the next closed bar a chandelier trail follows the move at 4.00 x live ATR behind the highest high / lowest low, so the trail widens in volatility spikes instead of being noise-stopped.
- A far take-profit cap (+6R) rests at the broker. A fixed bracket style (SL -1R / TP +2R, never modified) is available with one input.
POSITION SIZING, AND WHAT IT COSTS ON A SMALL ACCOUNT
The lot is solved so that a full stop-out on the opening leg costs InpDynRiskPct of balance (default 1.0%). The same run at three deposits:
- 1,000 USD: +2,557, worst drawdown 19.5%, 202 trades, 9 entries refused by the risk cap
- 3,000 USD: +4,085, worst drawdown 8.5%, 264 trades, 2 refused
- 10,000 USD: +19,493, worst drawdown 10.3%, 319 trades, none refused
A 1,000 USD account is not a smaller version of a 10,000 USD one. The broker's minimum lot is a floor, so on the smallest trades the realised risk sits ABOVE the 1% you asked for and the drawdown roughly doubles. From about 3,000 USD that effect has largely gone. When even the minimum lot would risk more than InpRRMaxRiskPct (default 4%) of balance the EA refuses the entry outright: it would rather not trade than trade oversized.
PROTECTIONS
- Broker-side SL and TP on every position.
- Daily loss stop, three-strike consecutive-loss cooldown, spread filter, free-margin buffer, same-direction cooldown after a full stop loss, and an EA-side emergency backstop that fires only if the broker stop failed.
- Session guard: no entries, and no stop modifications, during the daily break or ahead of the weekend.
- After a restart the EA re-adopts its open positions, identifies the base and pyramid legs, re-arms missing stops from the broker's resting orders, and rebuilds the loss streak, its cooldown and the daily-loss anchor from account history.
WHAT CHANGED IN v4.04
Four fixes that only show up on a live account, and one default. No input was renamed or removed; existing input sets load unchanged.
- The consecutive-loss breaker was blind to pyramided trades. A basket whose second leg lost more than the first made was scored from the base leg, which sits at breakeven, so neither the three-strike breaker nor the direction cooldown ever armed on it. Both now read the realised result - the breaker engages 18 times instead of 11.
- The daily-loss anchor was set after the loss. The day rolled over inside a routine only reached while flat, so a position carried overnight and stopped out early re-based the budget from the post-loss balance. The rollover now runs on every tick.
- Requests are no longer sent into the daily break. The EA used to learn the market was shut only by having a request rejected. It now uses the same dead-hour window it already refuses to open new trades in - 26 rejected requests removed on a 2024 test.
- Volume caps are respected on every path. The symbol total-volume limit was never read, and the basket cap was enforced only on the averaging path. The lot is now trimmed, or the entry skipped.
- Trail width 3.50 -> 4.00 x ATR. The sweep is a plateau on both data sets available and 3.50 sat at the bottom of it. Over eleven years the 4.00 setting returns +42,757 at a 21.74% drawdown against 3.50 at +30,519 and 20.42%.
OPTIONAL GRID RECOVERY ENGINE (InpUseRRTrail=false)
A classic ATR-scaled averaging grid with a volume-weighted basket take-profit resting broker-side, an optional lot multiplier, a cap on levels and total basket volume, and a basket equity stop. It is OFF in the shipped configuration and we do not recommend turning it on: on XAUUSD H1 2015-2026 it lost money on every preset we measured. The Mad preset trades without any stop-loss - an eleven-year test from 10,000 USD ended at 800 - and is refused on live accounts.
RECOMMENDATIONS
- Symbol and timeframe: XAUUSD, working timeframe H1. The timeframe is set by the InpTimeframe input, not by the chart - the EA reads its own timeframe, so it can be attached to any chart.
- Minimum deposit 1,000 USD; 3,000 USD or more recommended. Sizing becomes fully proportional from roughly 5,000 USD.
- Low-spread account and a VPS.
- Set a unique magic number per chart. The default is 20250728; change it on the second chart.
THE PARTS THAT ARE NOT FLATTERING
- Every figure above is a backtest. There is no forward-test record yet.
- The EA makes very little in quiet gold - 2015-2018 was flat - and makes money in trending gold. The most recent window measured, July-September 2026, lost money: -432.50 on nine trades, profit factor 0.14.
- Walk-forward on XAUUSD H1, 2015-2026, six two-year windows, 1% risk: five profitable, one flat. Profit factor by window 1.03 / 1.00 / 1.26 / 1.39 / 1.19 / 1.80, worst window drawdown 18.3%. Those folds were measured with the older 3.50 trail and have not been re-split at the shipped 4.00.
- Results differ substantially between data feeds. The same period on two brokers' prices produced results a factor of two apart, so treat any single number as indicative rather than precise.
RISK WARNING
The optional grid engine averages into losing positions and its Mad preset deliberately trades without a stop-loss - that logic can produce deep drawdowns or the loss of the account on a sustained trend, which is why Mad is blocked on live accounts. Test on a demo account first, use conservative settings, and never trade money you cannot afford to lose. Past backtest results do not guarantee future performance.
