In this tutorial, we show how to build an RSI Mean Reversion cBot for cTrader using Xen AI. The strategy uses the Relative Strength Index to identify potential overbought and oversold market conditions. When RSI reaches an oversold level, the cBot can open a buy trade. When RSI reaches an overbought level, it can open a sell trade. The exit logic then closes trades when RSI returns toward a neutral level.
This is a simple yet useful example for traders who want to learn how to move from a strategy idea to a working cTrader trading robot, using plain-English instructions.
Building a cBot with plain English
One of the main advantages of Xen AI is that you do not need to start by writing C# code manually. Instead, you describe the trading logic in plain English, and Xen generates the cTrader cBot source code for you.
For this example, the requirements are intentionally kept clear and focused. The cBot should use RSI to detect potential mean-reversion opportunities, include configurable input parameters, and be suitable for backtesting and optimisation within cTrader.
RSI mean reversion strategy rules
The cBot is based on a common RSI mean reversion idea:
- Open a buy trade when RSI falls below the oversold level.
- Open a sell trade when RSI rises above the overbought level.
- Close buy trades when RSI returns above the buy exit level.
- Close sell trades when RSI returns below the sell exit level.
- Use optional stop-loss and take-profit protection.
- Only manage positions opened by this cBot.
The default RSI settings used in the tutorial are typical starting values: a 14-period RSI, 30 for oversold, 70 for overbought, and 50 as a neutral exit level. These values are not fixed trading advice. They are starting points for testing and optimisation.
Input parameters for optimisation
A good cBot should expose the key settings as input parameters so the trader can test different values in cTrader. In this tutorial, the cBot includes inputs such as:
- RSI period.
- Oversold level.
- Overbought level.
- Buy exit level.
- Sell exit level.
- Trade volume in lots.
- Stop loss in pips.
- Take profit in pips.
- Label name.
- Enable buy trades.
- Enable sell trades.
This makes the strategy easier to backtest, optimise and refine after the first version has been created.
From generated code to cTrader
The video demonstrates the full workflow, not just the code generation step. After Xen AI creates the cBot, the next stage is to verify the build and publish it into cTrader.
This is an important part of the process. AI-generated code should always be checked, compiled and tested before it is used in any trading environment. Xen AI helps speed up development, but the trader still needs to validate the result.
Preparing the strategy for backtesting
Once the cBot has been published to cTrader, it can be tested using historical data. Backtesting helps you understand how the strategy behaved under previous market conditions.
For an RSI mean-reversion strategy, backtesting is especially important because the system can behave very differently in ranging and trending markets. Mean reversion strategies may perform well during sideways conditions, but they can suffer when the market trends strongly in one direction.
Using Xen AI as part of the development cycle
The real strength of Xen AI is not only creating the first version of a cBot. It can also support the wider development process.
A practical workflow is:
- Describe the strategy idea.
- Generate the cBot.
- Verify and publish the code.
- Run a backtest in cTrader.
- Review the results.
- Ask Xen AI to suggest improvements.
- Refine the strategy and test again.
This creates a structured development cycle where the trader can move from idea to prototype, then from prototype to a more carefully reviewed trading system.
Why this tutorial is useful
This video is part of the Build cBots with Xen AI tutorial series. The aim is to show practical examples of automated trading strategies being created for cTrader using AI.
The RSI mean reversion example is a good starting point because it is easy to understand, uses a familiar indicator and demonstrates how clear requirements can be turned into a working cBot.
Try Xen AI
Xen AI is designed to help cTrader users build trading robots, indicators, trading panels, dashboards, plugins and custom tools using plain English.
You can try Xen AI here:

