Giter Site home page Giter Site logo

geneticalgotrading's Introduction

Genetic Algorithm optimised Trading Strategy.

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:

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.

Relative Strength Index (RSI):

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.

Combined Strategy:

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.

Potential Results:

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.

Considerations:

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.

geneticalgotrading's People

Contributors

saurabhdhingra avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.