GithubHelp home page GithubHelp logo

mortiniera / algorithmic-trading-technical-indicators Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 3.0 9.42 MB

Python implementation of simple algorithmic trading strategies using Momentum and Trend following technical indicators used by traders and investors in financial markets to analyze past market data and identify potential trends or patterns in the price and volume of an asset.

Jupyter Notebook 41.30% HTML 58.70%
finance python statistical-analysis stock-market talib technical-analysis trading

algorithmic-trading-technical-indicators's Introduction

About

Python implementation of simple algorithmic trading strategies using Momentum and Trend following technical indicators used by traders and investors in financial markets to analyze past market data and identify potential trends or patterns in the price and volume of an asset.

Setup

On a Macbook, if you are having issues when installing ta-lib with pip and requirements file.

Use the following commands.

conda create -n finance python=3
conda activate finance
brew install ta-lib
conda install -c conda-forge ta-lib # do not use: pip install ta-lib

Check your installation on terminal with the following commands

python
import talib
talib.__ta_version__

You should see your talib version printed !

Workaround reference link : TA-Lib/ta-lib-python#408 (comment)

1. MACD - Moving Average Convergence Divergence

This Notebook presents a comprehensive analysis of investment strategies using the performance metrics of GAFAM stocks - Google, Apple, Facebook(now Meta), Amazon, and Microsoft. The project evaluates two distinct approaches: an active strategy utilizing Moving Average Convergence Divergence (MACD) for trading signals, and a passive strategy employing dollar-cost averaging (DCA) with the SPDR S&P 500 ETF Trust (SPY) as a benchmark.

Implementation of MACD is double-checked with Ta-Lib, a widely used open-source trading software to perform technical analysis of financial market data. (Reference : https://machinelearning-basics.com/)

The analysis spans a two-year period, with an initial investment capital of $$100,000$, focusing on the daily allocation of $500 to understand the effectiveness of dollar-cost averaging in mitigating market volatility. The inclusion of transaction costs provides a realistic touch to the simulation, highlighting the impact of trading expenses on investment returns.

For simplicity here, we decided to use stock closing prices, however as always, these analysis can be done using opening prices or intra-day trading data as well, provided one has access to them.

Data come from Yahoo Finance API.

The evolution of portfolio values is visualized through Matplotlib graphs, illustrating the trajectories of GAFAM Portfolio stocks and its cumulative value over time.

We utilize a various performance metrics such as total and annualized returns, maximum drawdown, Sharpe Ratio, Sortino Ratio, beta, and alpha to offer a multifaceted view of the strategies' outcomes.

The findings offer insightful revelations about the benefits and limitations of active versus passive investment strategies in the context of a highly volatile market, highlighted by the tech sector's performance (here Big Tech Giants in particular).

This notebook serves as both a strategic introduction guide and an education template for financial analysis in making informed decisions backed by quantitative data.

Caveat : Please note that I am not a financial advisor, and this analysis should not be taken as financial advice. The study may presents potential biases inherent in historical data analysis, model assumptions or implementations errors, and readers are advised to conduct further research and seek professional advice before making investment decisions.

More details regarding the implementation at : https://github.com/Mortiniera/algorithmic-trading-technical-indicators/blob/main/MACD/An%20Introduction%20to%20Algorithmic%20Trading%20-%20MACD.ipynb

References

References :

algorithmic-trading-technical-indicators's People

Contributors

mortiniera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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