Trend Master D
- Experts
- 버전: 1.0
- 활성화: 10
Trend Master D — Two Complementary Trading Logics in One EA
This EA combines two complementary trading logics designed to balance each other: one follows breakouts, the other capitalizes on false breakouts (reversals). Using both together on the same instrument has produced strong risk-adjusted results, as you can see from the pictures below.
Backtest results:
- Over 252% profit, trading 1 lot per trade on a $100,000 initial balance.
- 2,474 trades over more than 9 years of historical data, with the last 3 years kept fully out-of-sample to prevent overfitting.
- Performance has accelerated further on out-of-sample data: since the start of 2026 (as of July 2026), the EA returned 115% in the last 6 months alone.
- Maximum drawdown under 23% compared to the initial balance, which is solid for an EA combining two parallel logics. Thanks to the decorrelation between the two strategies, the EA sums their profits but doesn't increase the drawdown.
All data shown in the pictures below is from IC Markets, using GMT+2 broker time. Always run your own backtest to confirm these settings work equally well on your broker's historical data — fine-tune if needed. I also backtested the EA with dukascopy data with the same settings and still had solid results.
How to run both logics together
Attach the EA to two separate charts of the same instrument (e.g. Gold), and load the second parameter set (Version = 2) on one of them. Each instance needs a different magic number to prevent conflicts — this can be changed freely from the input parameters.
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, 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: true. 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, Mfilter3 — default: false. These four are monthly filters. If set to true, the EA will not trade in the selected months (these can be very powerful).
- Dfilter, Dfilter1, Dfilter2, Dfilter3 — default: false. These four are daily filters. 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, Month3 — These four 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, Day1, Day2, Day3 — These four are daily filters. 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 — default: 5(%). Stop loss parameter. Do not use negative numbers. Decimals can be used. (It may look like a wide stop loss, but it is meant only for emergency situations. The EA barely uses it at all across the 9+ years of backtest.)
- myprofit — default: 2.76(%). Take profit parameter. Do not use negative numbers. Decimals can be used.
- duration — default: 48. IGNORE this parameter entirely. Do not modify it. It is part of the code's structure.
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).
Minimum suggested capital: 1000$. You may go as low as 500$, but you may have trouble with margin.
Account type needed: Hedging.
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.
IMPORTANT! After purchasing, please send me a private message through MQL5 to receive the my settings' files for Version 1 and Version 2.
The last two pictures show the separate results of the two strategies (Version 1, Version 2) with my settings.
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.