Code Monkey home page Code Monkey logo

bollingerbands's Introduction

Welcome to Bollinger Bands with Pete!

In this project we used pre-saved historical data to backtest and analyze (both implemented in this project) bollinger band strategies. As a fun extra to the project we also implemented Monte Carlo Simulations to better validate the strategies

The files:

Analyzer - This contains the analyzer. Running this prints out information about the backtest such as the total returns, and the biggest losing and winning trades. It also gives you the option to plot any individual symbol with the trades displayed on there. This allows for convenient analysing of the model as you can try to pinpoint where the trades are going wrong/right.

BaseStrategy - This is a parent Strategy and is useless on its own. All new strategies should import from here. If a new strategy is to be created it should be a child of this and be structurally similar to BollingBandInitial. Note: The strategies need not be Bolling Band Related. Create the indicators in the add_indicator function, add the logic to the run function and you have an entirely new strategy.

BBStopLoss - This is an extension of BollingerBandInitial which has a basic stop loss implemented. It is a good example of how simple it can be to edit models, compare this to BollingerBandInitial

BBWithTrend - This was an extension of BBStopLoss which only bought stocks if the signal is in line with the short term trend. Spoiler Alert: It did not work.

BollingerBandInitial - This is a create example of how to implement a strategy and if you wish to use this code to build different strategies I'd use this as a guideline.

bringAllTogether - As soon as you look at this code I recommend opening and running this to get an idea of the outcome of the code (It will also likely hit you with a load of imports). Make sure you change the filepath. This will also allow you to see the key functions and classes within the code.

MCAnalyze - This was a fun addition to the project. In order to better validate the model I created a monte carlo analysis tool. This runs slightly seperately to the analyzer so is not included in bringAllTogether but make sure to check it out, there is an example use at the bottom of the class

utils - Just has some random useful functions in it, wouldn't worry too much about this.

Any questions feel free to connect with me on linkedin at: www.linkedin.com/in/petermikhaeil or email me at [email protected]

bollingerbands's People

Contributors

petemik avatar

Watchers

James Cloos 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.