This repository provides a Python implementation of the Bollinger Bands indicator trading strategy. The Bollinger Bands indicator is a popular technical analysis tool that helps identify overbought and oversold conditions in the financial markets.
The Bollinger Bands indicator consists of three lines:
- Middle Band (20-day Moving Average)
- Upper Band (Middle Band + 2 standard deviations)
- Lower Band (Middle Band - 2 standard deviations)
This trading strategy generates buy and sell signals based on the price crossing above or below the Bollinger Bands. When the price crosses above the upper band, it is considered overbought, and a sell signal is generated. Conversely, when the price crosses below the lower band, it is considered oversold, and a buy signal is generated.
- Calculation of the Bollinger Bands (Middle Band, Upper Band, Lower Band)
- Generation of buy and sell signals based on the Bollinger Bands
- Calculation of cumulative returns from the trading strategy
- Visualization of stock prices, Bollinger Bands, and trading signals
- Python 3.x
- pandas
- yfinance
- matplotlib
If you would like to contribute to the development of the Bollinger Bands indicator or have suggestions for improvement, feel free to submit a pull request or open an issue in the repository. Contributions and feedback are always welcome!
This project is licensed under the MIT License. You are free to use, modify, and distribute the code as per the terms of the license.
The implementation of the Bollinger Bands indicator is based on the original concept introduced by John Bollinger. Special thanks to John Bollinger for his contributions to technical analysis.