Genetic algorithms (GAs) represent a class of optimisation algorithms inspired by the process of natural selection and genetics. Originating from the field of evolutionary computation, GAs have gained prominence in solving complex optimisation and search problems across various domains, equity and cryptocurrency trading being one of them. In this research, we look at one such strategy commonly applied in trading algorithms and try to put genetic algorithms to optimise our parameters.
A trading strategy based on Bollinger Bands and the Relative Strength Index (RSI) combines two popular technical indicators to make trading decisions. Here's an explanation of the potential results and considerations when using such a strategy:
Bollinger Bands consist of a middle band, which is usually a simple moving average (SMA), and two outer bands that are standard deviations away from the middle band. They are used to identify volatility and potential reversal points in the price of a financial instrument. When the price is near the upper band, it may be considered overbought, suggesting a potential reversal or pullback. Conversely, when the price is near the lower band, it may be considered oversold, indicating a potential upward reversal.
RSI is a momentum oscillator that measures the speed and change of price movements. It ranges from 0 to 100 and is typically used to identify overbought or oversold conditions. RSI values above 70 are often interpreted as indicating overbought conditions, suggesting a potential reversal to the downside. RSI values below 30 are considered oversold, signaling a potential reversal to the upside.
Traders using a strategy based on both Bollinger Bands and RSI may look for confluence or confirmation signals. For example: A sell signal could be generated when the price is near the upper Bollinger Band, indicating potential overbought conditions, and the RSI is above 70. A buy signal could be generated when the price is near the lower Bollinger Band, suggesting potential oversold conditions, and the RSI is below 30.
The results of using a Bollinger Bands and RSI-based strategy can vary based on market conditions, the timeframe used, and the specific parameters chosen for the indicators. Positive outcomes may include successfully identifying trend reversals and capturing profitable trades during periods of overbought or oversold conditions. Challenges may arise in ranging markets where price movements are less pronounced, leading to false signals or whipsaws.
Like any trading strategy, it's essential to conduct thorough backtesting to evaluate the historical performance of the strategy under various market conditions. Traders should consider transaction costs, slippage, and other practical aspects of trading that can impact the actual results compared to theoretical ones. Regularly reassess and potentially adjust strategy parameters based on changing market conditions. It's crucial to note that no trading strategy guarantees success, and all trading involves risk. Traders should exercise caution, use risk management techniques, and consider the limitations and potential drawbacks of any technical analysis-based strategy. Additionally, strategies should be adapted to individual preferences, risk tolerance, and market conditions.
The genetic algorithm that I have designed for optimising this particular strategy considers an individual with 5 genes :
- The length of the RSI calculation period,
- The length of the Bollinger Bands calculation period,
- The RSI overbought level,
- The RSI underbought level, and
- The exit point.
The algorithm first generates a population set of individuals generated by taking random values from a range we provide the algorithm.
The fitness function backtests it against historical values fetched from Binance APIs.
After mutating and applying crossover mating algorithms over a predefined number of generations it generates a list of individuals which can be used with the strategy.