Skip to content

RSI cBot

Strategy Overview

The RSI cBot implements a simple momentum-based reversal trading strategy that relies on the Relative Strength Index (RSI) as its key indicator.

The RSI cBot automatically buys and sells based on RSI values that reflect market momentum and determine overbought or oversold conditions. The cBot is coded to close existing positions before opening new ones, and this ensures that only one relevant position is open at any time.

When the RSI falls below 30, the market is seen as oversold, and the cBot opens buy positions. The buy signal is based on the expectation that the price will increase after the market reaches an oversold condition.

When the RSI rises above 70, the market is seen as overbought, and the cBot opens sell positions. The sell signal is based on the expectation that the price will drop after the market becomes overbought.

The strategy based on the RSI indicator is best suited for markets where the cBot can trade reversals based on RSI signals.

Download cTrader

Indicator Integration

The Relative Strength Index (RSI) is the main indicator used in the RSI cBot. RSI is a momentum oscillator that measures the speed and change of price movements. It ranges between 0 and 100 and is used to identify overbought or oversold conditions in the market.

Based on its assessment of overbought or oversold conditions, the RSI determines whether the cBot buys or sells. The RSI cBot does not rely on any other indicator or factor, such as moving averages or volume; it uses only RSI levels for trading signals.

The cBot focuses on two key thresholds:

  • RSI < 30 signals that the market is oversold and triggers buy orders
  • RSI > 70 signals that the market is overbought and triggers sell orders.

The cBot continuously monitors the RSI value by checking it on every new tick. This ensures that the algorithm is always ready to act once the RSI moves into oversold or overbought territory.

Logic

Initial Setup

The RSI indicator is initialised using the specified Source and Periods parameters in the OnStart() method, which is called when the cBot starts. The calculations are done using cTrader built-in formulas for the indicator.

Condition Monitoring

The conditional logic for trades is executed in the OnTick() method, which is called every time a new tick (price update) is received. If RSI < 30, a buy signal is generated. If RSI > 70, a sell signal is generated.

Position Management

Before the cBot opens a new position based on the generated signal, the Close() method checks for and closes all open opposite positions with the "SampleRSI" label. This setup ensures that only one trade is active at any time for a given symbol.

Trade Execution

The Open() method checks whether a position of the same type based on the generated signal (buy or sell) is already open. If a position is not found, the cBot opens a new position with the specified quantity and other parameters that are passed inside the method.

Parameter Unit Definition Tips
Quantity Lot Volume of each trade. Conservative traders may opt for small lot sizes to minimise risk. Aggressive may opt for larger lot sizes to maximise potential gains, albeit with higher risk.
Source Data source for the RSI indicator. Available options include the close price, open price, high price and low price. The closing price is often used for RSI calculations because it reflects the most important price point in a candle. However, traders may experiment with different data series and select the one that best suits the market conditions.

The high price or low price can help identify extreme price movements, while median or typical prices offer a more balanced perspective over a period.
Periods Number of periods (candles) used to calculate the RSI. The default value, 14, is the standard value or popular setting for this indicator. Scalpers or traders looking to profit from short-term price movements (e.g., on a 5-minute chart) may opt for low periods. This setting makes the RSI more responsive, causing it to generate buy/sell signals more frequently.

Swing or long-term traders (e.g., on a 1-hour chart) may prefer bigger RSI periods. This setting decreases the RSI sensitivity, making it smoother and more resistant to quick price fluctuations. With noise filtered out, the RSI focuses on major market trends and generates fewer signals.

Application

Range-Bound (Sideways) Markets

In a range-bound market, prices oscillate between a resistance level (upper boundary) and a support level (lower boundary). Such events are ideal for RSI-based strategies because they provide many overbought and oversold instances. As prices frequently reverse direction when hitting support or resistance levels in range-bound markets, the RSI is more likely to provide accurate signals.

Use Case

Consider a scenario where EUR/USD repeatedly moves between 1.1000 and 1.1200. The cBot can demonstrate good performance by buying near the lower boundary for oversold (RSI < 30) and selling near the upper boundary for overbought (RSI > 70).

Best Practices

  • Focus on trading during periods of low volatility. The RSI indicator works better when the market is not making significant trending moves.
  • Check price charts for periods when price fluctuates within a clear range.
  • Monitor for breakouts. If the price moves significantly outside the range, stop the cBot and reassess market conditions.

Low-Volatility Markets

Low-volatility markets are characterised by small price movements and a lack of major trends. The RSI is particularly useful in such environments because it can identify short-term market imbalances without being influenced by strong directional trends.

In low volatility environments, price tends to oscillate between overbought and oversold levels, leading to frequent trading opportunities for the cBot.

Use Case

A stock index such as the S&P 500 may exhibit periods of low volatility, where its price moves between narrow bands. During such periods, the cBot takes advantage of small reversals. It enters buy positions when the RSI dips below 30 and sell positions when the RSI rises above 70.

Best Practices

  • Use volatility indicators to determine when the market is entering a low volatility phase.
  • Adjust the lot size and RSI periods to enable the indicator to target small price changes effectively.
  • Use additional risk management strategies such as a stop loss to guard against unexpected market moves.

After a strong upward or downward trend, markets often enter a consolidation phase where the price stabilises. Traders then take profit or wait for a new market direction, and the consolidation period becomes ideal for RSI-based trading strategies.

In the consolidation period following a strong trend, the RSI indicator can identify when the market has moved into overbought or oversold territory. The RSI cBot can then catch reversal points within the consolidation.

Use Case

Consider a scenario in which a blue-chip stock enters consolidation following a significant rally or drop. The stock price begins to oscillate within a narrow range. The cBot then detects overbought (RSI > 70) or oversold (RSI < 30) conditions during this phase and trades accordingly.

Best Practices

  • After a strong trend, wait for the market to start consolidating before running the cBot.
  • Monitor longer-term support and resistance levels to ensure the market has truly entered consolidation and is not preparing for another breakout.

Summary

The RSI indicator is central to the cBot strategy, and it drives all buy and sell decisions. While the cBot is effective at using the indicator to capitalise on reversals in oversold and overbought markets, its reliance on a single algorithm comes with the risk of false signals and limited market context.

The ability to specify values for key parameters and select a data source allows users to adapt the RSI cBot to their individual trading styles, risk tolerance and market conditions. Whether you are a scalper, a swing trader or a long-term investor, adjusting the cBot parameters can lead to better alignment with your strategy and increased chances of success.

Traders can backtest the cBot with different values, settings and data to find an optimal or profitable parameter combination for their chosen symbol and timeframe. Additionally, cTrader users can modify the cBot code and implement volatility indicators to guard against strong trends and filter out non-reversal signals.

Download cTrader