Your EA has been running for a month and the account is down 15%. You open the source code to figure out what went wrong, and it's a wall of function calls: iMACD, iRSI, iBands, iMA. You have no idea why the EA opened that position at that price, or why it held through a 40-pip drawdown instead of closing.
This is a common situation. You don't need to become a coder, but you do need to understand what these four indicators are actually measuring. Once you do, the EA's behavior stops being mysterious and starts being readable.
Moving averages: the trend filter
A moving average (MA) does exactly what it sounds like. It takes the closing prices of the last N candles, averages them, and plots the result as a line. Each new candle updates the average by dropping the oldest price and adding the newest one. The line "moves" with the price.
| Type | Full name | How it calculates | Character |
|---|---|---|---|
| SMA | Simple Moving Average | Equal weight to all prices | Smooth and slow |
| EMA | Exponential Moving Average | More weight to recent prices | Faster to react |
Most EAs use EMA because it responds to price changes more quickly. If you see iMA in the code with MODE_EMA, that's what's happening.
Reading MA signals
The classic setup is a crossover between a fast MA and a slow MA. Take EMA(12) and EMA(26): when the fast line crosses above the slow line, that's a bullish signal (sometimes called a golden cross). When it crosses below, bearish (death cross). This is the foundation of probably half the trend following EAs in existence.
An even simpler use: price above MA(200) means the long-term trend is up, price below means it's down. Many of the EAs we build use this as a first-pass filter. If price is below the 200 MA, the EA won't take long trades regardless of what other indicators say. It prevents a lot of bad entries.
One thing to keep in mind: MAs are lagging indicators. They tell you which direction the trend has been moving. They won't warn you about reversals. Don't use them for catching tops and bottoms.
MACD: momentum between two moving averages
MACD looks intimidating on the chart, but the concept is simple: it measures whether two EMAs are getting farther apart or closer together. If they're spreading apart, momentum is increasing. If they're converging, momentum is fading.
The default parameters are (12, 26, 9):
- MACD line = EMA(12) minus EMA(26)
- Signal line = 9-period EMA of the MACD line
- Histogram = MACD line minus signal line
When the MACD line is positive, the short-term MA is above the long-term MA, which means upward momentum. Negative means downward momentum.
Three ways to read it
Crossovers are the most common signal in EAs. MACD line crosses above the signal line: go long. Crosses below: go short. Simple, but it works best in trending markets and generates a lot of false signals during ranging conditions.
The zero line tells you when the trend has actually flipped. MACD crossing from negative to positive means EMA(12) just overtook EMA(26), confirming a trend change. We use this as a secondary confirmation in several of our trend EAs rather than as a standalone entry.
Divergence is the most useful but least reliable signal. Price makes a new high, but MACD doesn't. That's bearish divergence, and it suggests the upward push is running out of steam. The catch: maybe 4 out of 10 divergences actually lead to reversals. The other 6 are false alarms. We treat divergence as "stop adding to positions" rather than "reverse immediately."
RSI: overbought doesn't mean "sell"
RSI (Relative Strength Index) uses a default period of 14. It calculates what percentage of the total price movement over those 14 candles was upward. The result is a number between 0 and 100.
| RSI range | Textbook interpretation | What actually happens |
|---|---|---|
| Above 70 | Overbought | Bulls are in control. Might be overextended, might keep going. |
| Below 30 | Oversold | Bears are in control. Could bounce, could keep falling. |
| 40–60 | Neutral | No clear signal. Mostly noise. |
The biggest mistake beginners make: seeing RSI hit 75 and immediately shorting because "it's overbought." In a strong trend, RSI can camp above 70 for weeks. During the 2022 dollar rally, the DXY RSI sat around 75 for over a month. Anyone shorting "overbought" got crushed.
RSI works well in ranging markets. When price is bouncing between support and resistance, RSI above 70 is a reasonable sell signal and below 30 is a reasonable buy signal. In trending markets, it's unreliable as a standalone signal.
This is why most well-designed EAs combine RSI with a trend filter. A setup we use frequently: MA(200) confirms the trend is up, then the EA waits for RSI to pull back to the 40–50 range before entering long. It's not buying at overbought levels and it's not trying to catch a reversal. It's buying the dip within an established trend.
RSI divergence works the same way as MACD divergence. Price makes a new high, RSI doesn't. When both RSI and MACD show divergence simultaneously, the signal is stronger. Still not guaranteed, but the odds improve.
Bollinger Bands: how far price has strayed from normal
Bollinger Bands have three components:
- Middle band: SMA(20)
- Upper band: middle + 2 standard deviations
- Lower band: middle - 2 standard deviations
Standard deviation measures how volatile the price has been. When volatility is high, the bands widen. When it's low, they contract. Statistically, about 95% of price action falls between the upper and lower bands.
Touching the upper band doesn't mean "sell." It means price has moved significantly above its recent average. Whether that's a reversal signal or a breakout signal depends entirely on market context.
Range markets vs trending markets
In a range, Bollinger Bands are a mean reversion tool. Price hits the upper band, you sell. Price hits the lower band, you buy. The expectation is that price returns to the middle band. This works well when the market is chopping sideways.
In a trend, the rules flip. Price rides along the upper band during a strong uptrend. Selling the upper band in this situation means selling into momentum, which is a great way to get stopped out repeatedly. Instead, you wait for price to pull back to the middle band and enter in the direction of the trend.
The way to tell which mode you're in: watch the bandwidth. When the bands contract to their narrowest point in recent history, that's a Bollinger Band squeeze. It means volatility is unusually low and a breakout is likely. The direction of the breakout usually kicks off a meaningful move. Several of our EAs monitor bandwidth as a volatility trigger, entering positions when the squeeze breaks.
Combining indicators: a practical framework
Every indicator has blind spots. MA lags. MACD also lags. RSI fails in trends. Bollinger Bands need you to know whether the market is ranging or trending before they're useful. Combining them covers each other's weaknesses.
Here's a framework we use in several FXTool EAs:
Start with MA(200) as a trend filter. Price above it? Only look for long entries. Price below? Only shorts. This eliminates roughly half of all bad signals before you even look at anything else.
Then check MACD for momentum confirmation. Is the histogram expanding in the direction of your trade? If so, the trend still has energy. If it's contracting, the move might be exhausted, so wait.
Finally, use RSI or Bollinger Bands for entry timing. Wait for RSI to pull back to a reasonable level (40–50 in an uptrend, 50–60 in a downtrend) or for price to touch the Bollinger middle band. Enter there instead of chasing.
Practical example: EURUSD is trading above EMA(200). The MACD histogram just flipped from negative to positive and is expanding. RSI pulled back from 65 to 48 and is turning up. Price bounced off the Bollinger middle band. Four signals pointing the same direction. Go long.
That's considerably more reliable than entering on a single MACD crossover.
| Indicator | Role | What it solves |
|---|---|---|
| MA(200) | Trend filter | Prevents trading against the trend |
| MACD | Momentum check | Confirms the trend still has energy |
| RSI | Entry timing | Avoids buying at the peak |
| Bollinger Bands | Volatility context | Shows how far price is from its average |
One warning: requiring all four indicators to align before entering will dramatically reduce the number of trades. You might wait weeks for a setup. In practice, picking two or three that complement each other is enough. What matters is knowing what role each indicator plays in your system. Read our how to choose an EA guide for more on evaluating strategy logic.
FAQ
Should I change indicator parameters from their defaults?
Start with the defaults. MACD(12,26,9), RSI(14), Bollinger(20,2) have been market-tested for decades and work across most instruments and timeframes. Fine-tune after you understand the indicator deeply and have a specific reason for changing. Random optimization leads to overfitting.
Which timeframe works best for these indicators?
No single "best" timeframe. H4 and daily charts produce more reliable signals with less noise, which makes them better for beginners. M5 and M15 generate more signals but also more false ones, requiring tighter filters. The shorter the timeframe, the more filtering you need. Our backtest guide covers how to test across different timeframes.
MACD divergence appeared but price kept rising. What now?
Divergence is an early warning, not a command. Price can rise another 100–200 pips after divergence appears. The right response is to stop adding long positions, not to reverse immediately. Wait for the price structure to actually break — a close below a key support level or a moving average crossover — before acting on the divergence. Read more about navigating this in our backtest vs live trading gap guide.
Is the indicator logic in EAs the same as manual trading?
The math is identical. EAs just execute faster and without hesitation. The advantage is discipline: the EA follows the rules at 3 AM on a Tuesday exactly the same way it does at 2 PM during London open. The limitation is that indicators can't process news events, central bank surprises, or geopolitical shocks. That's why many EAs include a news filter to pause trading around scheduled events.
What if RSI and MACD divergence appear simultaneously?
Two different indicators showing divergence at the same time is a stronger signal than either one alone. Different algorithms are independently detecting the same thing: price momentum is weakening. Stronger doesn't mean guaranteed, though. Always have a stop loss in place. Every EA in the FXTool marketplace uses indicator combinations like these, and you can check the exact logic in the strategy descriptions.
About the author: The FXTool team builds and tests MetaTrader trading tools daily. We run every EA we sell on live accounts and publish the results. This guide reflects what we've learned from building 50+ EAs and working with thousands of retail traders.
Forex trading involves significant risk and may result in total loss of capital. This article is for educational purposes only and is not investment advice. Understand the risks and consider your financial situation before trading.