TrendRider EA: trading robot for MQL5
TrendRider EA is a trend-following advisor that automatically holds a position in the direction of a moving-average cross.
How the advisor works
The advisor encodes a simple rule: long while the fast EMA is above the slow one, short while it is below. The value of automation here is not sophistication but discipline: the EA executes each reversal mechanically, without the hesitation that would ruin a discretionary trader during an extended trend.
The flip side of automation is that the robot does exactly what it was programmed to do, including entering every false reversal in a range. For trend-following advisors this is the main source of losses: without a market-state filter the EA whipsaws on every moving-average cross inside a sideways range.
Parameters and metrics
| Parameter | Value |
|---|---|
| EMA fast / slow | 50 / 200 |
| Timeframe | H4 |
| Trailing stop | ATR × 1.5 |
| Risk per trade | 1% |
Check on real data
The advisor's logic was run on real quotes without fitting parameters to history. The rule tested was "TrendRider: EMA(50/200) trend following":
- Long while EMA(50) is above EMA(200).
- Short while EMA(50) is below EMA(200).
- Reversal on the moving-average cross — the robot is always aligned with the trend.
Pros and cons
- Mechanical discipline: holds the trend without emotion.
- Simple logic that resists overfitting.
- Transparently testable on history.
- Loses money in ranges — reacts to every false cross.
- Always in the market, accumulating costs on reversals.
- Gives back part of the profit on the turn while the averages realign.
Pitfalls
TrendRider fails in a range: without a trend filter the advisor enters on every moving-average cross, and in a range there are dozens of them. The second common mistake when launching an EA is optimizing the moving-average periods against past data until the backtest looks pretty — on new data such curve-fitting almost always performs worse than the standard periods.
Who it suits
For traders automating trend-following logic on trending instruments who understand that the advisor must be paired with a range filter. Not suitable for ranging markets.
Related methodology
Frequently asked questions
Why is automating this rule better than trading it by hand?
Discipline. A discretionary trader tends to close the position early or miss the reversal out of doubt; the advisor executes the rule without exceptions. It is this rigor, rather than any complexity of the logic, that usually provides the edge.
Why does the advisor lose money in a range?
It enters on every moving-average cross, and in a range the averages intertwine constantly. Without a market-state filter this turns into a series of losing reversals.
What does the backtest show?
The behavior of the rule on a real EUR/USD sample. On a trendless stretch a trend-following advisor predictably goes into the red — an illustration that it needs a trending market.