Gold Expansion D
- Experts
-
Daniele Fughelli
Hi! I'm Daniele. I've been developing trading EAs for more than 4 years. Everything I create is based upon years of data and stress-tested by me. I always use out-of-sample data for final validation. For any questions, message me, and I'll answer you as soon as possible. Making EAs takes effort and - Version: 1.0
- Activations: 10
Effective and robust throughout 9 years of backtest, 3 of which were out-of-sample, "Gold Expansion D" is the EA that I would always keep in my EAs portfolio.
This EA uses a breakout strategy by default (a reversal strategy is also possible by changing the "Version" parameter from 1 to 2), exploiting the inherent characteristics of Gold itself. It is specifically designed for Gold, but can be adapted to other markets by changing its input parameters.
Backtest results:
- Over 241% profit, trading 1 lot per trade on a $100,000 initial balance.
- 3,076 trades over more than 9 years of historical data, with the last 3 years kept fully out-of-sample to prevent overfitting.
- Maximum drawdown under 49% compared to the initial balance, which is solid considering how profitable the strategy has been on out-of-sample data.
All data shown in the pictures below is from IC Markets, using GMT+2 broker time, but I've got similar performance on FTMO's propfirm as well, which is reknown for its significantly higher spreads. This means the strategy is quite robust against spread. Always run your own backtest to confirm these settings work equally well on your broker's historical data — fine-tune if needed.
How to run
Attach the EA to a chart and change the input parameters as you see fit. If you use it on Gold (XAUUSD) you can use the default input parameters, which have been used to achieve the backtest shown below.
Versatility
The EA can be adapted to any financial market (commodities, forex, etc.). The default settings are calibrated specifically for Gold (XAUUSD) — adjust the parameters accordingly if testing on a different instrument.
Backtesting tip
Since the EA only evaluates candle opens and closes, you can use "1 Minute OHLC" modelling for backtests instead of tick data. This runs significantly faster while producing nearly identical results — worth verifying for yourself.
Lot sizing
Lot size is fixed, not percentage-based. I intentionally avoided account-percentage sizing, since it can amplify losses after a winning streak. You're free to adjust the lot size manually at any time.
Input Parameters
- SIZE — default: 0.01. Lot size parameter. Be very careful when changing it. Do not use negative numbers.
- GMT — default: 2. Timezone parameter. Change it according to your broker's timezone. Do not use negative numbers or decimals.
- Magic Number — default: 1. This MUST be different from any other EA's magic number on each specific chart to prevent conflicts (especially if you use this EA with different settings on the same instrument, as recommended). Do not use negative numbers or decimals.
- EuroDST — default: false. Daylight saving time change for European brokers. Test it on "true" and "false" to see which solution works better for you.
- starttime — Trading starting hour: you can set numbers from 0 to 2400 using multiples of 100 (e.g. 100, 200, 300, ..., 1000, 1100, ...). For European brokers, make sure this value is lower than "endtime." Do not use negative numbers or decimals.
- endtime — Trading ending hour: you can set numbers from 0 to 2400 using multiples of 100 (e.g. 100, 200, 300, ..., 1000, 1100, ...). IMPORTANT: if you set 2400, the parameter "CloseAtEnd" will not work properly when set to "true." Do not use negative numbers or decimals.
- CloseAtEnd — default: true. This parameter closes the currently open trade when the time of the last closed bar is equal to or greater than "endtime." Set to "false" if you want to keep trades open overnight (the EA's performance will change completely — test it if you want to create something new).
- Version — default: 1. Allowed numbers: 1 or 2. If set to 1, it will use the breakout logic, trying to follow the trend. If set to 2, it will use the false breakout logic, capitalizing on reversals. Do not use negative numbers or decimals. Do not use any number other than 1 or 2 (no trades will happen otherwise).
- stopPercent — default: true. This parameter lets you choose the stop loss and take profit as a percentage (%) of the last closed bar's closing price. I created it specifically for Gold, since its value has changed so much over time. It can be used for any other instrument, but the difference from a normal price-based stop loss and take profit will be smaller, since the forex market moves more slowly. If set to "false," stop loss and take profit will be set in absolute price value (e.g. 0.005$).
- Mfilter, Mfilter1, Mfilter2 — default: false. These three are monthly filters. If set to true, the EA will not trade in the selected months (these can be very powerful).
- Dfilter — default: true. This is the daily filter. If set to true, the EA will not trade on the selected days (e.g. all Mondays, all Fridays, ...).
- OnePerDay — default: false. If set to true, the EA will only trade once per trading day (not used in my settings).
- Month, Month1, Month2 — These three are monthly filters. Each number from 1 to 12 corresponds to a specific month (1: January, 2: February, ...). Do not use negative numbers or decimals. Do not use numbers higher than 12.
- Day — This is the daily filter. Each number from 0 to 6 corresponds to a day of the week (0: Sunday, 1: Monday, ..., 6: Saturday). Do not use negative numbers or decimals. Do not use numbers higher than 6.
- mystop — Stop loss parameter. Do not use negative numbers. Decimals can be used.
- myprofit — Take profit parameter. Do not use negative numbers. Decimals can be used.
Exit logic:
The EA closes a position only if stop loss or take profit is triggered, if the time of the last bar is equal to or greater than "endtime" (when CloseAtEnd is set to true), or if the conditions to reverse the position are met (in which case the EA closes the current open position and immediately opens another one in the opposite direction).
Be careful when changing "myprofit" and "mystop": stop loss and take profit are the two most overfitting-prone parameters of this EA.
Leave a comment on the EA's page if you need help setting any parameter, or for any other question. I'll answer as soon as possible.
TimeFrame: 30 minutes. You may change it but further backtests will be needed (as well as parameters fine-tuning).
Account type needed: Hedging.
Financial Instrument: Gold.
If you are new to lot sizing, modify SIZE in backtest and check the largest and average profits and losses at the end of it. This way you'll understand how much risk you are taking before actually trading with the new lot size you decided.
No martingale, no grid trading or stuff like that. The EA opens only one position at a time.
Please, be aware that drawdowns can happen and are part of the process. This is not a get rich quick scheme (even though the backtest results are truly good). Always test the algorithm in a demo account first.
Past performance is not indicative of future results. Trading involves risk, and you should only trade with capital you can afford to lose.