Skip to content
All library documents

Automated RSI Entries and Exits with Fixed and Trailing Stops

Article MQL5 code base

Summary

This brief example outlines a two-sided automated strategy based on a 14-period RSI calculated from closing prices. It opens a buy when RSI falls below 25 and closes that position once RSI rises above 50. For short trades, it opens when RSI rises above 75 and closes when RSI falls below 50. The rules use threshold crossings to define entries and exits, applying the same midpoint exit level to both directions.

The example also mentions a trailing stop and fixed take-profit and stop-loss settings, but it gives no values or explanation of how those controls interact with the RSI exits. There is no market or timeframe specified, and no backtest, transaction cost analysis, or risk-adjusted performance evidence. It is presented as a simple first published code example, so the stated thresholds should be treated as an illustration rather than a validated trading system.

Key ideas

  • The strategy uses a 14-period RSI computed from closing prices.
  • Long positions open below 25 RSI and close above 50 RSI.
  • Short positions open above 75 RSI and close below 50 RSI.
  • The example includes trailing-stop and fixed take-profit and stop-loss controls but gives no parameter values.
  • No market, timeframe, or performance evaluation is supplied.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.