Skip to content

Python Bollinger Bands algorithmic trading strategy backtest

License

Notifications You must be signed in to change notification settings

coasensi/bollingerbands-backtest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This Python program is designed to backtest a technical analysis based algorithmic trading strategy.

The strategy

The Bollinger Bands strategy is a technical analysis tool used to identify overbought and oversold conditions in the market. It involves calculating three lines: a simple moving average (SMA, 20 days in our example) of the stock price, an upper band set at 2 standard deviations above the SMA, and a lower band set at 2 standard deviations below. Signals are the following:

BUY when the price crosses the lower band from the top. Hold until it crosses the upper band from below.

SELL when the price crosses the upper band from below. Hold until it crosses the lower band from the top.

This strategy leverages mean reversion, expecting prices to revert back to the mean (SMA) over time.

The initial report focuses on TSLA stock but additional reports provide backtests of this strategy on numerous stocks and indexes.

About

Python Bollinger Bands algorithmic trading strategy backtest

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published