RangeReturnTrail MT5
- Experts
-
Eloizio Coelho Alves
Sono un trader brasiliano con esperienza in analisi tecnica e algoritmi intelligenti per il mercato finanziario.
Attualmente utilizzo una combinazione di EA proprietari e modelli Python avanzati per identificare opportunità con maggiore precisione. - Versione: 1.5
- Attivazioni: 5
RangeReturnTrail MT5 is an Expert Advisor designed to identify strong price expansions and look for opportunities when the market begins to return from those movements.
The EA uses dynamically trailing pending orders, allowing it to follow the current price movement before entering the market. Instead of entering immediately against a strong move, the EA waits for a reversal or pullback to activate the pending order.
RangeReturnTrail MT5 can be used on Forex pairs, metals, indices, cryptocurrencies, CFDs, and other symbols available in MetaTrader 5, provided that the broker supports the required order types.
Although it is a multi-asset Expert Advisor, its logic is especially suitable for volatile instruments such as Gold – XAUUSD, where strong directional movements and subsequent pullbacks occur frequently.
How RangeReturnTrail Identifies a Trading Opportunity
The EA continuously analyzes a configurable number of candles.
The default configuration is:
- Bars to Analyze: 10
- Minimum Range: 1000 points
- Lot Size: 0.01
- Trailing Start: 500 points
- Trailing Stop: 100 points
The EA finds the highest high and the lowest low within the analyzed candles.
When the distance between these two extremes reaches or exceeds the configured minimum range, the EA identifies a significant price expansion and prepares a pending order.
The current candle is also included in the analysis, allowing the EA to react while the market movement is still developing.
Trend Direction Detection
The EA also evaluates the chronological order in which the highest and lowest price levels occurred.
If the lowest point occurred first and the highest point occurred later, the movement is interpreted as an upward expansion.
In this situation, the EA places a:
SELL STOP below the current price.
If the highest point occurred first and the lowest point occurred later, the movement is interpreted as a downward expansion.
In this situation, the EA places a:
BUY STOP above the current price.
The objective is not to enter immediately against the current move. The EA waits for the market to begin returning before the pending order is activated.
Trailing Pending Orders
One of the main features of RangeReturnTrail MT5 is the dynamic movement of pending orders.
The pending order is initially positioned at a configurable distance from the current market price.
During an Upward Movement
A SELL STOP is positioned below the market.
If the price continues rising, the SELL STOP also moves upward, following the price at the configured distance.
However, when the price starts falling, the pending order does not move downward again.
It remains at its last position.
If the market continues to reverse and reaches the SELL STOP, the order is activated and becomes a market SELL position.
During a Downward Movement
The opposite logic is applied.
A BUY STOP is positioned above the current market price.
As long as the market continues falling, the BUY STOP follows the price downward.
When the market starts rising, the pending order stops moving.
If the price reaches the BUY STOP during the reversal, the order becomes a market BUY position.
This mechanism allows the EA to follow the expansion while waiting for confirmation of a possible return movement.
Pending Trail Step
The Pending Trail Step parameter defines the minimum number of points required before the EA modifies the pending order again.
This prevents unnecessary order modifications caused by very small price fluctuations.
Single Position Trailing Stop
When there is only one BUY or one SELL position opened by the EA, RangeReturnTrail uses a standard trailing stop mechanism.
The default configuration is:
- Trailing Start: 500 points
- Trailing Stop: 100 points
Example:
If a BUY position moves 500 points into profit, the trailing stop is activated.
At that moment, the Stop Loss is positioned approximately 100 points behind the current market price.
If the price continues moving favorably, the Stop Loss follows the movement.
If the market reverses and reaches the Stop Loss, the position is closed.
The opposite logic is applied to SELL positions.
Multiple Positions of the Same Type
RangeReturnTrail MT5 also includes special management for situations where two or more positions of the same type are open.
For example:
- BUY 1
- BUY 2
- BUY 3
Instead of managing each position independently, the EA begins to monitor the combined result of all positions on the same side.
The same logic applies to multiple SELL positions.
The EA calculates the total floating result of the group.
While the combined result remains negative, the basket trailing mechanism is not activated.
When the combined result reaches break-even or becomes positive, the basket trailing mechanism is activated.
From that moment, the EA manages the group as a single trading basket.
If the market continues moving favorably, the basket protection level follows the price.
If the market reverses and reaches the trailing protection level, all positions of that same type are closed together.
This allows profitable positions to compensate for losing positions before the entire group is closed.
Basket Trailing Line
When the basket trailing mechanism is active, a horizontal moving line is displayed on the chart.
This line represents the current protection level of the group.
It only moves in the favorable direction.
When the price reaches this line, the EA attempts to close all positions belonging to that basket.
Multi-Asset Trading
RangeReturnTrail MT5 is not limited to a single market.
It can be tested and used on:
- XAUUSD / Gold
- Forex pairs
- Indices
- Cryptocurrencies
- Metals
- CFDs
- Other compatible MT5 symbols
Because all major distance parameters are adjustable, the strategy can be adapted to different market characteristics.
A movement of 1000 points can represent very different market conditions depending on the symbol, number of digits, volatility, contract specifications, and broker.
For this reason, users should optimize the settings according to the instrument being traded.
Special Focus on Gold – XAUUSD
Although RangeReturnTrail MT5 is designed as a multi-asset Expert Advisor, Gold is one of the instruments that best matches its trading concept.
XAUUSD frequently presents:
- strong directional movements;
- rapid price expansions;
- high intraday volatility;
- sharp corrections;
- significant pullbacks after extended moves.
The EA was designed to follow these expansion movements with a pending order and wait for the market to begin returning before entering.
For this reason, XAUUSD is especially suitable for testing the RangeReturnTrail concept.
Settings should always be adjusted according to the broker, timeframe, account size, leverage, and market volatility.
Information Panel
RangeReturnTrail MT5 includes an integrated visual information panel.
The panel displays important account and EA information, including:
Current Status
- Balance
- Equity
- Floating Profit/Loss
- Number of BUY positions
- Number of SELL positions
- Number of pending orders
- Current spread
- Symbol
- Timeframe
- Magic Number
Weekly Performance
The panel also displays the realized result for each trading day:
- Monday
- Tuesday
- Wednesday
- Thursday
- Friday
- Total weekly result
Weekly statistics are filtered by the EA's symbol and Magic Number, helping prevent trades from other Expert Advisors or manual trading from being mixed with the RangeReturnTrail statistics.
Main Inputs
Lot Size
Defines the trading volume used by the EA.
Default:
0.01
Trailing Start
Defines the positive distance required before the trailing stop of a single position is activated.
Default:
500 points
Trailing Stop
Defines the trailing distance after activation.
Default:
100 points
Maximum Spread
Allows the user to prevent new entries when the current spread exceeds the configured limit.
Bars to Analyze
Defines how many candles are used to calculate the highest high and lowest low.
Default:
10 candles
Minimum Range
Defines the minimum distance required between the highest high and lowest low of the analyzed candles.
Default:
1000 points
Pending Distance
Defines the initial distance between the current market price and the pending order.
Pending Trail Step
Defines the minimum price movement required before the pending order is repositioned.
Magic Number
Unique identifier used by the EA to manage its own trades and statistics.
Margin Protection
RangeReturnTrail MT5 includes internal margin protection mechanisms.
Before sending a new pending order, the EA checks whether sufficient margin is available.
Additional protection is also used in extreme margin conditions to reduce the risk of reaching the broker's Stop Out level.
These protections do not replace proper money management.
The user remains responsible for selecting an appropriate lot size and account exposure.
Fixed Lot Trading
RangeReturnTrail MT5 uses the lot size selected by the user.
The EA does not automatically increase lot size after losing trades.
Its main strategy does not depend on an automatic lot progression system.
Hedging Accounts
The multiple-position basket management system was designed especially for MT5 Hedging accounts.
In Netting accounts, MetaTrader 5 combines trades of the same symbol into a single net position.
Therefore, the behavior of multiple individual positions may differ.
For full use of the basket management feature, an MT5 Hedging account is recommended.
Recommended Usage
Before using RangeReturnTrail MT5 on a live trading account:
- perform backtests;
- test different historical periods;
- test different symbols;
- test different timeframes;
- adjust point distances according to the instrument;
- use an appropriate lot size;
- consider spread and leverage;
- consider broker contract specifications;
- test the EA on a demo account before using real capital.
Risk Warning
No Expert Advisor can guarantee future profits.
Backtest results, demo results, and historical performance do not guarantee similar results in future market conditions.
Financial markets involve risk.
The user is fully responsible for the selected symbol, timeframe, lot size, settings, leverage, and overall risk exposure.
RangeReturnTrail MT5 — follow the expansion, wait for the return, and let the trailing mechanism manage the exit.

