
Optional (only for students who are on a Mac): Install Parallel so that you are able to use MetaTrader5 Python module later on (https://www.parallels.com/products/desktop/).
Install ta-lib, the technical analysis library, by selecting the Windows Python wheel and using pip install after confirming Python 3.9 64-bit in the Anaconda prompt, and verify by importing talib.
In this lecture, we talk about what Python expressions are.
In this lecture, we give an an overview of the native Python data types, and start our detailed examination of each data type.
We go over the numerics data type in Python in this lecture.
We discuss the string data types in Python in this lecture.
List is a very versatile data type in Python, and this is the topic for this lecture.
We will examine the tuple data type in this lecture.
We discuss the set data type in Python in this lecture.
Python dictionary is used very often every day, and we will go over the dictionary data type in this lecture.
We go over the fundamental control flow structure syntax in Python in this lecture. After this lecture, you will be able to work with all the native Python data types, and build decision logic into your code.
Learn to use Python and pandas to work with market data, build indicators, automate trading and recordkeeping, and objectively analyze your trading performance.
Import pandas as pd and load the gapminder csv into a data frame named world. Inspect its shape, data types, and missing values, and preview rows with head and tail.
Explore how data frames support heterogeneous columns—strings, integers, and floating point numbers—and how to access wide data frames using df.columns, with debugging tips and quick summary statistics.
Access the year column in a pandas data frame using square brackets, yielding a pandas series. Verify its type with the type function.
Explore subsetting, indexing, and slicing in data frames using iloc and loc, selecting specific rows and columns, and retrieving single elements, with examples.
Learn how to compute unique values and value distributions in a pandas column using value_counts, sort_index, and unique for subregion data.
Learn to filter rows by applying a boolean condition in pandas, using square brackets to return only rows meeting a criterion like life expectancy above 82.
Practice filtering a world subregion by exact match and year using boolean series and the double equals operator, creating East Asia data frames limited to 2015.
Add new columns in a data frame by combining series, like multiplying population by GDP per capita. Scale values by dividing by a million to improve readability.
Learn how to sort a data frame by a chosen column in Python and control ascending or descending order to place larger numbers at the top.
Explore how to loop through an instrument-year list in Python, fetch live market data, and build indicators for a trading strategy, with the option to expand strategies using this format.
Explore user defined Python functions to build custom price action indicators for algorithmic trading, understanding inputs, return statements, or no return value when printing or plotting.
Learn to define and call a Python function that retrieves daily data from the MetaTrader five platform, using inputs like pair and time frame to process and return data.
Use try/except inside functions to keep multi-pair trading running when getting data for a pair fails, with clear debugging messages.
Use a try and except block to handle broker disconnections while processing multiple pairs, so your Python script continues to run, logs alerts, and returns market data.
Explore time zone aware datetime handling for algo trading by using a time zone module to align with the broker's server time, not just your local clock.
Learn to use Python's datetime module and Timedelta to fetch 500 days of market data, computing a start time in a time zone down to midnight UTC.
Convert datetime objects to strings with the date time module, formatting dates as year-month-day for time series analysis and string comparisons in algo trading with Python.
Install the MetaTrader5 module in Python, set up a project in the Anaconda prompt and Jupyter Notebook, import pandas, NumPy, and Talib, then verify installation by importing MetaTrader5.
Set the market data workflow to match market watch time by configuring the time zone, converting to UTC, and pulling data from 1000 days ago to now in Python.
Learn how to build indicators with pandas by computing percent change on close prices across periods, comparing current and prior bars, and overwriting data frames accordingly.
Learn to build indicators with Ta-Lib in Python, using high, low and close inputs and adjustable time periods, and assign results to a data frame while handling missing values.
Connect to MetaTrader 5 to fetch account information such as balance, equity, margin used, free margin, and view current positions and history for money and risk management in algo trading.
Are you a trader who is interested in learning how to build their own trading algorithm?
If so, this course will teach you the basics of Python - you will learn about all the native data types in Python, and know how to work with control flow structure so that you can have decision logic built into your code.
Trading is hard, but it is also highly rewarding. With Python, you can put in a methodical system to build your own rule-based algorithm in order to get to your goal efficiently.
Python is also the perfect language for AI-based algorithms using a variety of machine learning techniques. The AI-based courses are coming soon.
This complete course of algo trading with Python will teach all the Python syntax you need to know, and get you ready for working with Pandas, taking care of the DateTime objects, and handling errors. You will then immediately learn about how to use Python to connect to the MetaTrader5 terminal, and get market data as well as account information programmatically from your broker directly. You will also learn about constructing indicators that work for your style of trading, by using Pandas, Ta-Lib, or writing your own user-defined functions. You will learn how to programmatically compute position size but first decide where you would like to place your stop loss level, and then query some account information to complete the computation. You will learn about the specific ways that you will communicate, using Python, with your brokers to enter and/or exit trades with the computed size for your risk tolerance. Further, you will also learn about how to set the stop loss and take profit, how to move stop loss to breakeven, and how to update (trail) your stop-loss level after that point. Once you have learned all about these topics, you are able to build as many elaborate risk management strategies as you want in a way that you like to trade.
At the end of this course, you will have a firm understanding of what goes into building an algorithmic trading strategy from scratch. You will have not only all the tools necessary to create your own algorithmic strategies, but you will also know how to manage your positions, as well as take what you already know and set up a backtesting environment for yourself, so that you are able to systematically build and test strategies on an on-going basis.
The goal of the series is to give you an understanding of what goes into building an algorithmic trading strategy from scratch. By the end of the three-part series, you should have not only all the tools necessary to create your own algorithmic strategies, but you will also know how to manage your positions.