Cross EMA with Trend Filter
- Göstergeler
- Alfet Nigmatullin
- Sürüm: 1.0
Cross EMA with Trend Filter is an arrow indicator that generates buy and sell signals when two exponential moving averages (EMA 9 and EMA 21) cross. The indicator features built-in trend filters (ADX or EMA slope), which significantly reduce the number of false signals in sideways (ranging) markets.
The indicator displays clear arrows on the chart:
-
🔵 Green Up Arrow — Buy signal
-
🔴 Red Down Arrow — Sell signal
Signals
Buy Signal
The fast EMA (9) crosses the slow EMA (21) from below to above provided that a strong trend is present.
Sell Signal
The fast EMA (9) crosses the slow EMA (21) from above to below provided that a strong trend is present.
Filter Conditions
-
ADX Filter: A signal is generated only when the ADX value is above the specified threshold (default 25)
-
EMA Slope Filter: A signal is generated only when the slow EMA has sufficient slope (alternative to ADX)
Parameters
| Parameter | Type | Default Value | Description |
|---|---|---|---|
| FastEMA | int | 9 | Period of the fast exponential moving average |
| SlowEMA | int | 21 | Period of the slow exponential moving average |
| ADXPeriod | int | 14 | ADX calculation period |
| ADXThreshold | int | 25 | Minimum ADX value to generate a signal (range 20–40) |
| UseADXFilter | bool | false | Enable/disable ADX filtering |
| MinTrendStrength | double | 0 | Minimum slope of EMA21 in pips (0 = filter disabled) |
Configuration Recommendations
For Different Timeframes:
| Timeframe | ADXThreshold | MinTrendStrength |
|---|---|---|
| M5 - M15 | 30-35 | 15-20 |
| M30 - H1 | 25-30 | 25-30 |
| H4 - D1 | 20-25 | 40-50 |
For Different Asset Types:
| Asset | ADXThreshold | Note |
|---|---|---|
| Major FX pairs (EURUSD, GBPUSD) | 25 | Standard setting |
| Volatile pairs (GBPJPY) | 30 | Higher threshold = fewer signals |
| Metals (XAUUSD) | 20 | Gold often shows strong trends |
| Indices | 25-30 | Depends on volatility |
Advantages
✅ Easy to use — clear arrows on the chart
✅ False signal filtering — works only in strong trends
✅ Flexible settings — can disable filters for scalping
✅ Versatility — suitable for any timeframe and instrument
✅ Optimized performance — fast calculation, does not overload the terminal
Disadvantages
❌ Does not work in sideways (ranging) markets — intentionally filtered out
❌ Lagging indicator — EMAs are trend-following by nature
❌ Requires confirmation from other indicators on lower timeframes
Usage Examples
Scenario 1: Trend Trading on H1
-
Set UseADXFilter = true , ADXThreshold = 25
-
Wait for a green up arrow
-
Open a BUY position
-
Place stop loss below the nearest local low
-
Take profit — 2–3 times the stop loss size
Scenario 2: Scalping on M5
-
Set UseADXFilter = false , MinTrendStrength = 0
-
All EMA crossovers generate signals
-
Use additional filters (volume, support/resistance levels)
How It Works
The indicator calculates EMA 9 and EMA 21 values on each bar. When a crossover occurs, it checks the trend strength:
-
If ADX is enabled — checks whether ADX exceeds the specified threshold
-
If EMA slope is enabled — checks how steep EMA21 is
-
If both filters are disabled — a signal is generated on every crossover
Once trend strength is confirmed, an arrow appears on the chart.
Installation
-
Download the Cross_EMA_Arrows.ex4 file
-
In MetaTrader 4, go to: File → Open Data Folder → MQL4 → Indicators
-
Copy the file to the Indicators folder
-
Restart MetaTrader 4 or right-click in the Navigator → Refresh
-
Drag and drop the indicator onto the chart from the Navigator window
Frequently Asked Questions (FAQ)
Q: Why are there no arrows on the chart?
A: Possible reasons:
-
The ADX filter is rejecting signals (try lowering ADXThreshold)
-
The timeframe is too low (try H1 or higher)
-
The market is ranging (wait for a trend)
Q: Can I use this on tick charts?
A: Not recommended — too many false signals.
Q: Which broker works with this indicator?
A: Any broker that supports MetaTrader 4 with 5-digit quotes.
Q: Does the indicator repaint?
A: No, arrows are fixed on the current bar and do not change.
