<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&family=Source+Sans+3:wght@400;500;600;700&display=swap">

MA crossover with RSI filter

The robot looks for the same crossing of two moving averages, but it enters only if RSI confirms the direction: above its own level for a buy and below its own level for a sell. The second condition skips some of the signals.

  • Moving Average
  • RSI
  • Intermediate

Choose a platform: MT5 shows the chart and Inputs screenshots from MetaTrader 5, MT4 shows the chart with entries and the Inputs screenshot from MetaTrader 4.

How the robot trades

When it buys

The fast average crosses the slow one upward and RSI is above the buy level.

When it sells

The fast average crosses the slow one downward and RSI is below the sell level.

When it exits

A buy closes when the fast average drops below the slow one; a sell closes when it rises above it.

Screenshot 1 of 5

EURUSD, H4. The robot indicators and the deals from the MT5 strategy tester: arrows are entries, crosses are exits, and the lines join an entry to its exit.

The conditions as constructor blocks

Open a buy

(MA_Fast ≥ MA_Slow)
AND
(MA_Fast_Prev < MA_Slow_Prev)
AND
(RSI > RSI_BuyLevel (55))

Open a sell

(MA_Fast ≤ MA_Slow)
AND
(MA_Fast_Prev > MA_Slow_Prev)
AND
(RSI < RSI_SellLevel (45))

Close a buy

(MA_Fast ≤ MA_Slow)
AND
(MA_Fast_Prev > MA_Slow_Prev)

Close a sell

(MA_Fast ≥ MA_Slow)
AND
(MA_Fast_Prev < MA_Slow_Prev)

Inputs

These inputs appear in the expert advisor settings in MetaTrader 5 or MetaTrader 4, and they are what the strategy tester goes through when it optimises the robot.

InputDefaultWhat it means
InpMA_Fast_period9Period of the fast average: how many recent candles it averages.
InpMA_Slow_period21Period of the slow average: the larger it is, the calmer the line and the rarer the signals.
InpRSI_period14RSI period: how many recent candles it takes into account.
RSI_BuyLevel55RSI level for buys: a buy opens only when RSI is above it.
RSI_SellLevel45RSI level for sells: a sell opens only when RSI is below it.
The inputs dialog of the MA crossover with RSI filter expert advisor in MetaTrader 5. Screenshot 1 of 2The inputs dialog of the MA crossover with RSI filter expert advisor in MetaTrader 5. Screenshot 2 of 2
This is how the expert's inputs look in MetaTrader 5

How to tune the robot to your style

  • Move the levels apart, for example to 60 and 40: fewer signals, each confirmed more strongly.
  • Change the periods of the averages and watch how the number of signals changes.
  • Replace the RSI filter with another indicator, such as MACD.

You can do all of this in the constructor without signing up. To save your changes and come back to them later, you need an account.

Risks

How a strategy behaved in the past does not predict its future results. Check the robot in the strategy tester and on a demo account first, and only then decide whether to trade it with real money. This robot is an example to adapt to your instrument, timeframe and risk rules.

Similar robots