Disclaimer: This article is for educational and informational purposes only. It does not constitute financial or investment advice. Trading forex and CFDs carries significant risk of loss. Past performance of any strategy — including backtests — does not guarantee future results. Never trade with money you cannot afford to lose.
What Is This Strategy?
The Gann Activator Trend is a trend-following expert advisor built around the classic Gann HiLo Activator, a simple regime-switching indicator that flips a market between an "up" state and a "down" state and then rides the move until the trend rolls over. The Gann HiLo Activator works by comparing each newly closed bar against a moving average of recent highs and a moving average of recent lows — two "rails" that price must decisively break to change the market regime. Because the strategy reads only completed bars, its signals do not repaint (they never change after the fact), which makes it a clean example for studying how a mechanical trend filter behaves.
This strategy is designed for trending market conditions. Trend-following systems like this one aim to capture sustained directional moves — the kind you often see in currency majors or metals during a strong drift — while sitting out or reversing when the market chops sideways. To help stay on the right side of the larger picture, the Gann Activator Trend layers a slower Exponential Moving Average (EMA) on top of the activator as a regime filter, only taking trades that agree with the broader direction.
As a learning tool, the Gann Activator Trend is well suited to intermediate traders who want to understand how a breakout-style trend indicator can be combined with a directional filter and volatility-based risk controls. It is not a shortcut to results; rather, it is a transparent, rules-based framework you can study, backtest, and dissect. The strategy is symbol- and timeframe-agnostic, so you can observe how the same logic responds across different instruments and chart periods.
How It Works
The Gann Activator Trend acts once per newly closed bar. On each closed bar it recalculates the activator rails, checks the regime filter, and manages any open position. Here is the logic in plain English:
- The activator rails: For every completed bar, the strategy averages the previous
HiLoPeriodhighs (smaHigh) and the previousHiLoPeriodlows (smaLow). These two averages form a trailing support/resistance band. - Direction flips: If the just-closed bar closes above
smaHigh, the activator flips up. If it closes belowsmaLow, the activator flips down. Otherwise the previous direction is retained — price must break the opposite rail to change regime, which gives the activator its characteristic staircase-like trend persistence. - Regime filter: A slower EMA (
TrendEmaPeriod) of closing prices keeps the strategy aligned with the bigger picture. Long trades are only considered when the close is above the EMA; short trades only when the close is below it. This filter discards many of the false flips that occur while price is chopping around its mean.
Entry conditions:
- Long: The strategy signals a long when the activator makes a fresh flip to up (it was not already up) and the close is above the trend EMA.
- Short: The strategy signals a short when the activator makes a fresh flip to down (it was not already down) and the close is below the trend EMA.
- The system always trades with the freshly confirmed direction, never against it, and holds at most one position at a time per magic number.
Exit and risk logic:
- Volatility-scaled stop loss: Every trade carries an ATR-based stop loss set at
AtrSlMult × ATRaway from entry. ATR (Average True Range) measures recent volatility, so the stop automatically widens in fast markets and tightens in calm ones. - Volatility-scaled take profit: A take profit is placed at
AtrTpMult × ATRfrom entry, defining the reward target in the same volatility-relative terms. - Flip-based reversal exit: The activator doubles as a reversal engine. If it flips the opposite way while a position is open, that position is closed immediately. If the regime filter agrees with the new direction, a fresh trade may then be opened the other way. In effect, the stop, the target, and the trend flip together bracket every trade.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| HiLoPeriod | 10 | 3 | 40 | Lookback length for the SMA-of-highs and SMA-of-lows that form the activator rails. Shorter values react faster and flip more often. |
| TrendEmaPeriod | 50 | 10 | 200 | Length of the slower EMA regime filter. Trades are only taken in the EMA's direction; larger values demand a stronger underlying trend. |
| AtrPeriod | 14 | 5 | 40 | ATR lookback used to size the volatility-scaled stop and target. |
| AtrSlMult | 2.0 | 0.5 | 6.0 | Stop-loss distance expressed as a multiple of ATR. Higher values give the trade more breathing room. |
| AtrTpMult | 3.0 | 0.5 | 10.0 | Take-profit distance expressed as a multiple of ATR. Together with AtrSlMult this sets the reward-to-risk ratio. |
| Lots | 0.10 | 0.01 | 1.00 | Fixed trade size in lots. Should be scaled to your account size and risk tolerance. |
| Magic | 40719 | 0 | 9,999,999 | Unique identifier so the EA only manages its own positions. |

Recommended Chart Settings
The Gann Activator Trend was designed with a trending FX major or metal in mind — for example EURUSD or XAUUSD (gold) — on the H1 (1-hour) timeframe. That said, the logic is symbol- and timeframe-agnostic: it runs on whatever single timeframe is selected, reading only closed bars. H1 offers a reasonable balance between signal frequency and noise, but you are encouraged to backtest other pairs and periods to understand how the activator's flip behavior changes. Results will vary considerably across different instruments and market conditions, so treat any single configuration as a starting point for study rather than a finished setting.
How to Install on MetaTrader 5
- Download the
GannActivatorTrend.ex5file from the link below. - Copy it to your MT5
MQL5\Expertsfolder. - Restart MetaTrader 5 or refresh the Navigator panel.
- Drag the EA onto a chart matching the recommended symbol and timeframe.
- Configure the input parameters and enable Algo Trading.
What to Consider Before Using This EA
Like every mechanical system, the Gann Activator Trend has strengths and clear limitations, and understanding both is the point of studying it.
Strengths. The activator's rule for changing direction is decisive and non-repainting, so signals are unambiguous and easy to audit. The slower EMA regime filter historically helps suppress the whipsaw entries that plague pure breakout systems in sideways markets. Because stops and targets are scaled to ATR, risk is defined and volatility-aware from the moment a trade opens.
Known limitations. The Gann HiLo Activator is fundamentally a trend-following tool, and trend-followers tend to struggle in ranging or choppy conditions. When price oscillates around its mean, the activator can flip repeatedly, generating a series of small losing trades — a pattern sometimes called "death by a thousand cuts." The EMA filter reduces but does not eliminate this. Likewise, because the flip exit can close a trade before the target is reached, the strategy may exit some moves early, and in sharply gapping markets an ATR stop may fill at a worse price than intended.
When it may underperform. Expect the approach to face headwinds during low-volatility consolidation, news-driven spikes, and prolonged range-bound phases. Its most favorable environment, historically, is a sustained directional trend — which is precisely the condition it was built to exploit. No parameter set makes a trend-follower immune to trendless markets.
Risk Management Tips
Sound risk management matters more than any single parameter choice. Consider these general principles:
- Position sizing: Match the
Lotssetting to your account size. A common guideline is to risk no more than 1–2% of account equity on any single trade, calculated from the distance to your stop loss. - Test on a demo account first: Run the EA on a demo account, or in the MT5 Strategy Tester, until you understand its behavior across a range of market conditions before considering any live use.
- Understand drawdown: Every strategy experiences losing streaks. Study the historical drawdown — the peak-to-trough decline in equity — so you know what a normal rough patch looks like and can avoid abandoning the plan at the worst moment.
- Diversify and avoid over-leverage: Concentrating risk in one symbol or using excessive leverage can amplify losses quickly. Keep leverage modest and size positions conservatively.
- Review regularly: Markets evolve. Periodically re-evaluate whether the chosen symbol, timeframe, and parameters still suit current conditions.
Risk Warning
Trading foreign exchange, CFDs, and other leveraged financial instruments involves substantial risk of loss and is not suitable for all investors. The strategies and tools discussed on this page are provided for educational purposes only and do not constitute financial advice, investment recommendations, or solicitation to trade. Always consult a qualified financial adviser before making trading decisions. Past backtest performance is not indicative of future results.
Downloads
- Expert Advisor: GannActivatorTrend.ex5 (0 downloads)
- Source Code: GannActivatorTrend.mq5 (0 downloads)
- Documentation: GannActivatorTrend.pdf (0 downloads)