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 Andean Oscillator Trend Shift is a trend-following trading system for MetaTrader 5 built around the Andean Oscillator, a relatively uncommon indicator introduced by Alex Grover in 2021. Unlike the moving-average, RSI, or Bollinger-band tools that dominate most trading libraries, the Andean Oscillator measures trend strength in a genuinely different way — by tracking the dispersion of price swings on the upside and downside separately. This makes it a useful study for anyone wanting to look beyond the standard toolkit.
At its heart, the indicator maintains running upper and lower envelopes of both the price and the price squared. Because statistical variance can be expressed as the average of the squared values minus the square of the average, combining these envelopes produces an online (bar-by-bar) estimate of the standard deviation of up-moves and down-moves. The strategy calls these two readings the bull and bear components. When a market trends higher, the bull component inflates; when it trends lower, the bear component grows. A smoothed signal line (an exponential moving average of the dominant component) then acts as the trigger for fresh conviction.
This system is designed as a learning tool for traders who already understand basic order execution and want to explore how a variance-based oscillator can define market regime and time entries. It is best suited to those studying trend-following mechanics on liquid instruments, and it is not a shortcut or a hands-off solution. Treat it as a framework for understanding how trend conviction can be quantified and acted upon.
How It Works
The strategy processes each newly closed bar, folds it into the Andean envelopes, recomputes the bull and bear components, and refreshes the EMA signal line. It then checks for a fresh expansion of conviction.
Entry conditions:
- Direction (regime): The larger of the two components sets the trend bias. If bull > bear, the market is judged to have upside conviction; if bear > bull, downside conviction dominates.
- Timing (trigger): An entry fires only when the dominant component crosses above the smoothed signal line — a sign that conviction is freshly expanding rather than fading.
- Long signal:
bull > bearand bull crosses above the signal line (it was at or below on the prior bar and is now above). The strategy signals a potential long. - Short signal:
bear > bulland bear crosses above the signal line. The strategy signals a potential short.
Stop-and-reverse logic:
- The system holds only one position at a time. When an opposite trigger appears, it first closes the existing trade, then opens the new one in the fresh direction. This "stop-and-reverse" behaviour keeps the EA aligned with the currently dominant side.
Stop-loss and take-profit logic:
- Risk distances are derived from the Average True Range (ATR) — a measure of recent volatility — so the strategy adapts to whatever symbol and timeframe you apply it to, rather than using a fixed point distance.
- For a long: stop-loss is placed
AtrStopMult × ATRbelow entry; take-profit isAtrTpMult × ATRabove entry. - For a short: stop-loss is
AtrStopMult × ATRabove entry; take-profit isAtrTpMult × ATRbelow entry. - With the default multipliers (2.0 stop, 3.0 target), the strategy historically aims for a reward-to-risk profile of roughly 1.5-to-1 on each trade, though actual outcomes depend entirely on market behaviour.
Because the ATR scales the exit distances automatically, the same parameter set can be studied across different volatility environments without manual recalibration.

Strategy Parameters
| Parameter | Default | Min | Max | Description |
|---|---|---|---|---|
| AndeanLength | 25 | 8 | 80 | Envelope length for the Andean Oscillator. Larger values create slower, smoother bull/bear components and fewer signals. |
| SignalPeriod | 9 | 3 | 40 | EMA length applied to the larger of the bull/bear components to form the signal (trigger) line. |
| AtrPeriod | 14 | 5 | 40 | Lookback period for the ATR used to size the stop-loss and take-profit distances. |
| AtrStopMult | 2.0 | 0.5 | 6.0 | Stop-loss distance expressed as a multiple of ATR. |
| AtrTpMult | 3.0 | 0.5 | 10.0 | Take-profit distance expressed as a multiple of ATR. |
| Lots | 0.10 | 0.01 | 1.00 | Order volume (position size) in lots. |
| Magic | 5731 | 0 | 9,999,999 | Unique identifier so the EA manages only its own trades. |
Adjusting AndeanLength and SignalPeriod changes how sensitive the system is: shorter values react faster but produce more noise, while longer values filter for larger, more established moves. The ATR multipliers let you widen or tighten the risk framework independently of the entry logic.

Recommended Chart Settings
The Andean Oscillator Trend Shift was designed to be timeframe-agnostic — it reads the primary symbol and timeframe from whatever chart you attach it to, rather than hard-coding a specific setting. In development and testing it was oriented toward trending FX majors or metals such as EURUSD or XAUUSD on the H1 or H4 timeframes, where directional swings tend to be clean enough for a variance-based oscillator to distinguish trend from chop.
That said, results will vary considerably across different market conditions, symbols, and timeframes. A setting that behaves well on a trending metal during one period may perform very differently on a range-bound currency pair in another. Always test any configuration on your own broker's data before drawing conclusions, since spreads, swap, and data feed differences all affect outcomes.
How to Install on MetaTrader 5
- Download the .ex5 file 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
Every strategy has strengths and blind spots, and understanding both is part of using any tool responsibly.
Strengths of this approach:
- The Andean Oscillator captures trend in a mathematically distinct way — through swing dispersion rather than a simple moving-average lag — so it can behave differently from more common indicators and add diversity to a study of trend systems.
- The self-adapting signal line means the trigger threshold adjusts to the market's own recent conviction, rather than relying on a fixed level.
- ATR-based exits let the same configuration scale across instruments and volatility regimes.
Known limitations:
- Like all trend-following systems, this strategy tends to underperform in choppy, sideways markets, where bull and bear components flip frequently and the stop-and-reverse logic can generate a string of whipsaw losses.
- The signal recomputes the full envelope series on each new bar. This is faithful to the original design because the envelope's alpha decays older bars, but it means the readings depend on how much closed history is available.
- Because the system is always in the market after its first signal (via stop-and-reverse), it may hold a position through unfavourable conditions until the opposite trigger appears.
- A fixed lot size does not account for account growth or drawdown; the position size stays the same regardless of balance unless you adjust it manually.
The most productive way to use this EA is as a case study in how a variance-based oscillator defines regime and times entries — not as a set-and-forget product. Observe how it behaves in different conditions and note where its assumptions break down.
Risk Management Tips
Sound risk management matters more than any single indicator. Whatever strategy you study, these general principles apply:
- Risk a small, fixed percentage per trade. Many educational resources suggest risking no more than 1–2% of account equity on any single position. Size your lots so that a stop-loss hit stays within that limit.
- Start on a demo account. Run the EA in a risk-free simulated environment first so you can observe its behaviour across weeks of live-like conditions before committing real capital.
- Understand drawdown. Even a historically sound strategy will experience losing streaks. Study the depth and duration of drawdowns so you know what you can tolerate emotionally and financially.
- Account for costs. Spreads, commissions, and swap fees all erode results, especially on shorter timeframes with frequent trades.
- Never over-leverage. Leverage amplifies losses as much as it magnifies gains. Keep exposure conservative, and never trade with money you cannot afford to lose.
- Review regularly. Markets evolve. A configuration that suited one regime may need reassessment as conditions change.
Approaching automated trading with discipline, realistic expectations, and continuous learning is far more valuable than chasing any specific setup.
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: AndeanOscillatorTrendShift.ex5 (7 downloads)
- Source Code: AndeanOscillatorTrendShift.mq5 (8 downloads)
- Documentation: AndeanOscillatorTrendShift.pdf (14 downloads)