Trend with Controlled Stop
- Experts
-
Alejandro Matias Pingaro
Ingeniero en Sistemas. Programo bots (asesores expertos) e indicadores en MQL5 para MetaTrader 5. Mi tesis de grado fue sobre estrategias de inversión para trading.
Bots desarrollados: DS (v1 a v3), EPP (v1 a v5), CML/CMS, TSC y SUPPLY.
Qué incluyo en cada trabajo: - Versione: 1.0
- Attivazioni: 10
Trend with Controlled Stop is an Expert Advisor for MetaTrader 5 that
trades moving average crosses filtered by RSI, with the loss and the
target defined in money instead of points.
HOW IT WORKS
The EA follows two exponential moving averages, a fast one and a slow
one. When the fast average crosses the slow one, that is the trend
signal. The RSI works as a filter: it rejects the signal when the move
is already stretched, so the EA does not buy at the top of a run or
sell at the bottom of one.
The EA evaluates only once per closed bar. Signals are not repainted
and an intrabar cross that later disappears does not trigger a trade.
SET THE RISK IN MONEY, NOT IN POINTS
This is the main idea of the EA. The stop loss and the take profit are
set as an amount in the account currency, not as a distance in points.
Write the amount you accept to lose and the amount you want to gain.
The EA converts both into a price distance using the tick value of the
symbol and the lot in use, and places the stop loss and the take profit
on the server, so they work even if the terminal is closed.
The practical consequence: the same settings keep the same risk on any
symbol. You do not have to recalculate distances when you move from a
currency pair to gold or to an index.
ENTRY CONDITIONS
- The fast moving average crossed the slow one on the last closed bar.
- For a buy, the RSI is below the configured ceiling.
- For a sell, the RSI is above the configured floor.
- There is no open position. The EA trades one position at a time.
AUTOMATIC BROKER ADAPTATION
Before sending any order, the EA corrects three things that differ from
one broker to another. Nothing has to be configured:
- It adjusts the lot to the minimum, maximum and step allowed by the
symbol, with the number of decimals the step accepts.
- It calculates the required margin and skips the trade if free margin
is not enough.
- It checks the minimum distance the broker requires for stops. If the
broker reports none, twice the current spread is used as a floor, so
the stop loss is never sent glued to price.
ON SCREEN PANEL
The chart shows a start and stop button and three lines of status: what
the EA is doing right now, the stop loss and take profit converted into
points for the current lot, and the floating result of its own
positions.
Pressing stop closes every position opened by this EA on the symbol.
The EA only manages its own trades, identified by the magic number, so
it can run next to other EAs or next to manual trading.
PARAMETERS
Lot size, stop loss and take profit in account currency, fast and slow
moving average periods, RSI period, RSI ceiling for buys and RSI floor
for sells, start enabled or stopped, maximum allowed deviation and
magic number.
The indicators are calculated inside the EA. They do not have to be
attached to the chart.
WORKS ON ANY SYMBOL AND TIMEFRAME
There is nothing tied to a particular pair. Because the risk is defined
in money, moving to another symbol does not require rescaling any
distance.
RECOMMENDATIONS
Test it on a demo account for several weeks before using real money.
Results vary between brokers because they depend on the spread, on
slippage and on server time.
Keep the fast moving average period below the slow one. On faster
timeframes, raising both periods reduces the number of false crosses.
A worthwhile test: split the period in two halves, find the values on
the first half and apply them unchanged on the second one. If the
result collapses, the values were fitted to the past.
RISK WARNING
Trading leveraged financial markets involves the risk of losing all
invested capital. This product is an automatic execution tool, not
investment advice. Each user is responsible for the settings chosen and
for the trades performed. Past behaviour does not guarantee or suggest
future results.
