Giter Site home page Giter Site logo

mathengem / algorithmic-trading-backtesting-in-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from karthikramx/algorithmic-trading-backtesting-in-python

0.0 0.0 0.0 431 KB

Code snippet show casing backtesting a strategy in python on historical stock market data.

Jupyter Notebook 100.00%

algorithmic-trading-backtesting-in-python's Introduction

=======

Algorithmic Trading (Backtesting in python)

Code snippet show casing backtesting a strategy in python on historical stock market data.

Intro
The goal of this article is to describe how to back-test a technical indicator-based strategy on python. I will specifically use a Bollinger band-based strategy to create signals and positions.

Description of strategy
Create 20-day (+/- 2 standard deviations) Bollinger bands on the adjusted close price. Buy, when the price crosses the lower band from the top and hold until the price crosses the upper band from below the next time. Sell when the price crosses the upper band from below and hold until the price crosses the lower band from the top the next time.

Here are the steps to create your own back-testing code.

  1. Import necessary libraries
  2. Download OHLCV Data
  3. Calculate daily returns
  4. Create strategy-based data columns
  5. Create strategy indicators
  6. Create signals and positions
  7. Analyze results

algorithmic-trading-backtesting-in-python's People

Contributors

karthikramx avatar mathengem 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.