DINEXSPACEXAUUSD SpecialistEAs available to rentCustom EA: Strategy → Code → BacktestView rentable EA bots
// RSI.MQ5

What is the RSI indicator?

Relative Strength Index (RSI)Momentum

Measures the strength of recent price moves and maps it to an easy-to-compare 0–100 scale.

What is Relative Strength Index?

A 0–100 oscillator that measures the speed and size of price changes, often used to spot overbought/oversold zones.

Relative Strength Index (RSI) — RSI(14) 69.0 — SIMULATEDDINEXSPACE / MomentumRSI(14) 69.0XAUUSD · 1H / SIMULATEDRESSUP2,330.92,361.02,451.42,426.9▲ BUYCandle 38: BUY▼ SELLCandle 86: SELLVOL*3070RSICANDLE 1CANDLE 29CANDLE 57CANDLE 85CANDLE 112MA · EMA 14 ━━━━ / VOL* · ILLUSTRATIVE CANDLE RANGEEMA 14Illustrative data — not real market data, not a trading signalRelative Strength Index (RSI) — RSI(14) 69.0 — SIMULATEDRSI 14XAUUSD · 1H / SIMULATEDRESSUP2,426.9▼ SELLCandle 86: SELLVOL*3070RSIRelative Strength Index (RSI) — RSI(14) 69.0 — SIMULATEDRSI 14XAUUSD · 1H / SIMULATEDRESSUP2,330.92,426.9▼ SELLCandle 86: SELLVOL*3070RSIRelative Strength Index (RSI) — RSI(14) 69.0 — SIMULATEDRSI 14XAUUSD · 1H / SIMULATEDRESSUP2,330.92,426.9▼ SELLCandle 86: SELLVOL*3070RSIEMA 14Illustrative data — not real market data, not a trading signal

Illustrative signals of the rule on simulated data — not a trading recommendation.

Rule: RSI(14) crosses above 30: buy; crosses below 70: sell. Entry = close of the signal candle; SL = entry ∓ 1.5 × ATR(14); TP1/TP2/TP3 = 1R/2R/3R.

Use this indicator to create a Custom EA brief →
// WHY_USE_IT

Where this indicator is strong

Three reasons Relative Strength Index is still used after decades.

A fixed scale

Always between 0 and 100, so it can be compared across currency pairs and timeframes.

Catches divergence

Price makes a higher high while RSI does not — a sign that momentum is running out.

Early warning

It reacts before price reverses, so use it to prepare, not to enter blindly.

// READING_SIGNALS

How to read Relative Strength Index signals

How Relative Strength Index (RSI) produces its number, and what each shape on the chart means.

Formula and how it works

RSI compares the average gain and the average loss over N periods using Wilder smoothing. The formula is RSI = 100 − 100/(1 + AvgGain/AvgLoss). Values above 70 suggest overbought, below 30 suggest oversold.

How to use it in an EA

Look for divergence between RSI and price to warn of a reversal; or look to buy when RSI leaves the oversold zone (30) and sell when it leaves the overbought zone (70).

Fits when

The market oscillates around a price zone, where overextended moves tend to get pulled back.

Struggles when

A strong one-way trend. RSI stays above 70 for many sessions while price keeps rising, and every counter-trend sell loses.

RSI above 70Overbought zone. In a strong uptrend RSI can stay here for a long time — it is not a sell order.
RSI below 30Oversold zone, read the same way in the opposite direction.
RSI leaves the extreme zoneThis is the signal usually used, not the moment it touches the zone.
Price makes a new high, RSI does notBearish divergence — momentum is not keeping up with price.
Common mistakes

Treating 70 and 30 as buy and sell orders. They are thresholds describing a state, not entry signals.

// PARAMETERS

Recommended MT5 parameters for Relative Strength Index

Default values of the sample file; test them for your market and timeframe.

ParameterDescription
InpPeriodPeriod for the average gain/loss (default 14).
// INSTALL

Put the indicator into MetaTrader 5

Four steps, no software needed besides MT5.

01Download the .mq5 file

Click the download button above; the file saves to your computer under the indicator's name.

02Open the data folder

In MetaTrader 5 choose File → Open Data Folder, then go to MQL5/Indicators.

03Compile

Open the file in MetaEditor and click Compile. No errors means the indicator is ready.

04Drag it onto the chart

Go back to MT5, refresh the Navigator and drag the indicator onto the price chart.

📄 rsi.mq5

DinexSpace wrote this file from the indicator's public formula, not from any commercial source. You are free to edit and reuse it.

// THE_DIFFERENCE

How it differs from MetaTrader 5's built-in indicator

The short answer: the formula is not different. What differs is what you can do with it.

Relative Strength Index here gives exactly the same number as MetaTrader 5's built-in version — on purpose. The four points below are what differs, and all four can be read from the very rsi.mq5 you download.

Calls a built-in indicator
No — the calculation sits in OnCalculate and can be copied straight into an EA
External libraries
Not a single #import declaration
Code length
60 lines · 1 input parameters
How it draws
A separate window below the price chart · calculated incrementally, does not redraw the past

Why this library promises no secret formula — read the full explanation on the library page.

// COMBINATIONS

Which indicators to pair Relative Strength Index with, and what you gain

Each indicator only answers one question. Pairing well means covering the right weakness, not stacking more.

Relative Strength IndexMoving Average
What you gain
Filters the allowed direction. In an uptrend by the MA, only take RSI signals leaving the oversold zone and drop all overbought signals.
Note
This handles RSI's fatal weakness: it reads overbought for many sessions while price keeps rising.
See Moving Average
Relative Strength IndexBollinger Bands
What you gain
Double confirmation at the band edge. When price touches the lower band and RSI is also below 30, two separate measures both say price has strayed far.
Note
Both indicators measure deviation from an average, so they are not truly independent — do not treat them as two separate pieces of evidence.
See Bollinger Bands
Relative Strength IndexAverage Directional Index
What you gain
Know when RSI can be trusted. ADX below 20 means a sideways market, exactly when RSI works best; with a high ADX, set reversal signals aside.
Note
This pair changes the question from 'what does RSI say' to 'should I listen to RSI right now'.
See Average Directional Index
// FAQ

Frequently asked questions about Relative Strength Index

Is RSI above 70 a sell signal?

No. It describes a state: price has risen strongly relative to its own recent history. In a healthy uptrend, RSI can stay above 70 for dozens of sessions while price keeps rising. The signal usually used is when RSI LEAVES the extreme zone, not when it touches it.

Is RSI divergence reliable?

Divergence is a warning that momentum is running out, not a reversal order. It can appear many times before price actually turns. Use it to tighten risk or take partial profit, and wait for price to confirm before entering the other way.

Does Relative Strength Index on this page use real or simulated data?

The chart on this page uses a deterministic simulated candle series; it is not market prices or trading results.

// SAME_GROUP

Other momentum indicators

Indicators in the same momentum group, often used instead of or alongside Relative Strength Index.

Turn Relative Strength Index into an automated EA

An indicator draws signals, but when to enter, where to stop out and how much to risk are still your set of rules. Send those rules and DinexSpace builds them into an EA.

Use this indicator to create a Custom EA brief