Opening block
You use MetaTrader 5 and want RCI added to your toolbox. You are a trader or a developer. You want clear numbers, exact math, and repeatable steps.
This article gives 6-step math, 5 concrete setups, and 5 MT5 installation and backtest steps. Expect specific periods: N = 9, 26, 52. Expect thresholds: ±80 for extremes. Expect backtest guidance: 1,000–5,000 bars and modeling ≥99%.
You will get performance targets: profit factor >1.5, max drawdown <20% (aim <10%), win rate 40–60%. You will see 3 practical risk controls and exact stop-loss ranges: 20–100 pips or 0.5–2% of position value. Use this to implement, tune, and validate RCI on MT5 without guessing.
Follow the math and the steps. Copy the indicator file, restart MT5, attach, and test. Use multi-period RCI to combine sensitivity and trend confirmation.
Quick Answer / TL;DR
- Want fast entries → use RCI-9 on a 5–15 minute chart with ±80 thresholds and a 3-bar confirmation.
- Want trend confirmation → use RCI-26 or RCI-52 on 1H+ charts and filter by price above/below a 50-period MA.
- Want automated testing → backtest 1,000–5,000 bars, target modeling quality ≥99%, and track profit factor and max drawdown.
- Want robust risk control → risk 1–2% per trade, use stop-loss 20–100 pips (or 0.5–2% of position value), and combine RCI with at least 1 additional filter.
Test on 1,000 trades or 1,000 bars minimum. Validate on 20–30% out-of-sample data. Skip aggressive N < 6.
RCI Definition and 2 Key Concepts
Define RCI. RCI (Rank Correlation Index) is a momentum indicator (measures speed and persistence of price moves). It computes a Spearman-style rank correlation between price and time (ranks instead of raw values). Output ranges from -100 to +100. This span equals 200 points.
Explain the output. A large positive reading, for example +80 to +100, means recent prices rank high versus past prices. Expect strong short-term upward momentum. A large negative reading, for example -80 to -100, means recent prices rank low and show strong downward momentum. A zero reading indicates no rank correlation.
Introduce two core uses. Use 1: overbought/oversold extremes for mean-reversion entries. Target ±80 to ±100 and confirm with 1–3 bars. Use 2: zero-cross and slope for trend confirmation. Define slope simply: change in RCI value per bar (for example slope > |10| per bar signals momentum). Short N values increase sensitivity (N = 9). Long N values increase lag (N = 52). Expect tradeoffs in false signals and delay.
Watch out for: RCI is sensitive to period N. Choose N = 9 for speed, N = 26 for balance, and N = 52 for trend validation. Handle ties by assigning average rank.
Calculation Steps in 6 Actions
Present the formula. Compute R = 1 – (6 Σd^2) / (N(N^2 – 1)). Multiply R by 100 to scale to ±100. The constants 6 and N(N^2 – 1) come from rank-correlation math.
Follow these 6 actions:
1) Select N bars (N typically 9, 26, or 52).
2) Assign ranks to closing prices from 1 to N (1 = lowest, N = highest).
3) Assign time ranks 1 to N (oldest = 1, newest = N).
4) Compute d = price_rank – time_rank for each bar (you will have N d-values).
5) Compute Σd^2 (sum of squared differences across N).
6) Compute R = 1 – (6 Σd^2) / (N(N^2 – 1)) and multiply by 100.
Show examples with numbers. For N = 9, a perfect inverse ranking gives Σd^2 = 240 and R = -100. For N = 9, perfect alignment gives Σd^2 = 0 and R = +100. For N = 26, expect Σd^2 values up to several thousand and a smoother R; for N = 52 expect even smoother curves and reduced spikes. Use N = 9 for scalps, N = 26 for standard entries, and N = 52 for higher-timeframe trend checks.
Handle ties carefully. Assign average rank for tied prices. A tie changes Σd^2 by small amounts. Expect small numerical differences when many equal prices appear, especially on low-volume instruments.
Watch out for: Always compute integer ranks. If your data has repeated prices, use average ranks. A one-bar indexing mismatch can shift signals by 1 bar.
Setting Up RCI on MT5 in 5 Steps
Explain availability. MT5 does not include RCI in most default builds. Add a custom indicator file (.mq5 or .ex5). Expect file size typically <50 KB for a single RCI indicator.
Follow these 5 concrete steps:
1) Download or code an RCI indicator (1 file, .mq5 or .ex5).
2) Copy the file into MQL5/Indicators inside MT5 data folder (use File → Open Data Folder).
3) Restart MT5 (restart time ~5–10 seconds).
4) Attach the indicator to a chart via Navigator→Indicators→RCI.
5) Set period N (e.g., 9, 26, 52), set thresholds ±80, set visual options, and save as a template.
Tweak inputs and appearance. Set line thickness 1–3 px. Use distinct colors for each period. Load 2–3 instances for multi-period setups. Place RCI in a separate subwindow or overlay on price. For multi-period, load RCI-9, RCI-26, and RCI-52 at once.
Check automation details. If you build an EA, match the indicator’s bar indexing and shift handling. A mismatch can delay a signal by 1 bar. Use the same timeframe for EA logic and indicator instances to avoid off-by-one errors.
Watch out for: Ensure the indicator and EA use the same bar indexing. Verify file permissions and that the .mq5 was compiled before running.
Practical Parameters: 3 Periods and 4 Signals
Recommend three standard periods. Short: N = 9 for fast signals and scalps. Mid: N = 26 for a balanced entry profile. Long: N = 52 for trend confirmation and low churn. Retune by ±10–30% around each base N.
Describe four concrete signals with numeric rules:
– Extreme reversion: RCI > +80 or RCI < -80. Enter on a reversal candle with 1–3-bar confirmation.
– Zero-cross momentum: RCI crosses 0 and slope > |10| per bar. Use for trend entries.
– Divergence: Price makes a new high while RCI fails to make a new high within the last 5–20 bars. Treat as weakening momentum.
– Multi-period agreement: Require at least 2 of 3 periods to signal the same direction. Example: RCI-9 and RCI-26 both > +50.
Give trade sizing and exit hints. Use risk-per-trade 1–2% of equity. Set stop-loss 20–100 pips on FX, or 0.5–2% of position value on CFDs and stocks. Aim for reward-to-risk ≥ 1.5:1. Set take-profit with a fixed ratio or use a trailing stop of 10–30 pips for intraday trades.
Watch out for: Extremes can persist. Do not enter on a single extreme without price confirmation. Check volume or price action before sizing up.
Backtesting and Optimization: 4 Metrics and 2 Sample Setups
Outline backtest basics for MT5 Strategy Tester. Use at least 1,000 bars or 1,000 trades for meaningful samples. Prefer 1,000–5,000 bars for intraday tests. Set modeling quality ≥99% when using tick or live tick data.
Track these four metrics with targets:
– Profit factor: aim > 1.5.
– Max drawdown: keep < 20% of equity, aim < 10%.
– Win rate: expect 40–60% depending on the setup.
– Average trade duration: report in minutes, hours, or days — for example 30 minutes for scalps or 2–7 days for swings.
Test these two sample setups:
– Setup A (scalp): RCI-9 on a 5-minute chart. Set SL 20 pips, TP 40 pips, and risk 1% per trade. Run on 2,000 bars and 1,000 trades if possible.
– Setup B (swing): RCI-52 on a 4-hour chart. Set SL 1.5% of position value, TP 3% of position value, and risk 1.5% per trade. Backtest on 1,000–5,000 bars and validate across 20–30% out-of-sample data.
Optimize carefully. Limit parameter sweeps to ±30% around base values. Validate on an out-of-sample chunk of 20–30% of your history. Avoid curve-fitting to small samples.
Watch out for: Overfitting is common when trying thousands of parameter combinations. Prefer modest sweeps like 3–5 values per parameter.
Common Mistakes and 3 Risk Controls
List common mistakes with numbers and remedies:
– Mistake 1: Using RCI alone. Combine with at least 1 filter.
– Mistake 2: Choosing N < 6. This creates noise and false signals.
– Mistake 3: Ignoring position sizing. Risking >2% per trade increases ruin probability.
Apply these three practical risk controls:
– Risk-per-trade rule: risk 1–2% of account equity per trade.
– Stop placement rule: set SL at 20–100 pips on FX or 0.5–2% on CFDs and equities.
– Confirmation rule: require 1 additional filter such as price above a 50-period MA. Use 50 as a concrete filter number.
Maintain execution hygiene. Use limit or stop orders to control slippage. Expect slippage 0–5 pips on liquid FX pairs, and larger slippage on thin stocks. Cap concurrent positions at 3–5 to limit exposure. Enforce a minimum wait time of 60–120 minutes before re-entry on the same instrument after a stop-out.
Watch out for: High-frequency re-entry after stops degrades long-term edge. Do not chase immediate re-openings without fresh confirmation.
Comparison Table of Common RCI Setups
Compare typical short, medium, and long RCI setups to pick the right sensitivity for your timeframe.
| Period (N) | Typical use | Sensitivity (0–100) | Signal lag (bars) | Best timeframe |
|---|---|---|---|---|
| 9 | Quick entries/scalping | 80–100 | 0–2 bars | 1m–15m |
| 26 | Balanced entries | 50–80 | 2–5 bars | 15m–1H |
| 52 | Trend confirmation | 20–50 | 5–20 bars | 1H–Daily |
| Custom 18 | Intraday swing | 40–70 | 3–8 bars | 30m–4H |
Short periods give high sensitivity and low lag. Longer periods reduce noise and increase lag. Combine periods for complementary signals.
How to Choose / Bottom Line
If you need fast entries and accept more false signals, choose N = 9. Require 2–3-bar confirmation and a secondary filter. Expect more trades and shorter average duration, for example 15–60 minutes.
If you need balanced entries with moderate noise, choose N = 26. Combine with a 50-period MA filter and require multi-period agreement. Expect 2–10 trades per week on typical FX pairs.
If you need trend confirmation and low churn, choose N = 52. Use it on 1-hour or higher timeframes only. Use it to avoid trading against the larger trend and to validate signals from RCI-9.
If still unsure, default to a combined approach. Use RCI-9 for entries, RCI-26 for confirmation, and RCI-52 for trend context. This setup provides sensitivity, confirmation, and trend awareness. Stick to risk rules: risk 1–2% per trade, set SL 20–100 pips or 0.5–2% value, and validate on 1,000–5,000 bars with modeling ≥99%.
Watch out for: Do not bypass out-of-sample tests. Do not raise risk above 2% without compelling live results. Test on 1,000 trades or 1,000 bars before allocating capital.