Description
QuantInsti – Backtesting Trading Strategies download, QuantInsti – Backtesting Trading Strategies review, QuantInsti – Backtesting Trading Strategies free
QuantInsti – Backtesting Trading Strategies
Backtesting Trading Strategies
You can improve your likelihood of success in trading by backtesting your trading rules on historical data. This course covers the steps to backtest a trading strategy, including getting financial data, validating the data, applying trading rules, assessing the strategy performance, and applying risk management measures such as stop loss and take profit. Make your backtest more realistic by incorporating slippage and commissions and avoiding common backtesting errors such as survivorship bias.
LIVE TRADING
 Describe the steps involved in backtesting a trading strategy and evaluate the performance of the backtest.
 Explain the fetching and pre-processing of data required for backtesting
 Define trading rules and generate trading signals of the strategy to backtest
 Apply trade-level analytics such as win ratio, average p&l for winning trade, profit factor and average trade duration
 Perform performance analysis of the backtest results using drawdown, sharpe ratio, cagr and equity curve
 Explain the process of improving the backtest by implementing transaction costs and slippage
 Describe the common pitfalls of backtesting such as data snooping etc.
 Paper trade and live trade your strategy
SKILLS COVERED
Statistics
Moving Average
CAGR
Sharpe Ratio
Maximum Drawdown
Profit Factor, Win%
Python
Numpy
Pandas
Line Graphs
Histograms
Vectorised Backtesting
Concepts & Bias
Data Snooping
Survivorship
Trading more than Volume
Stop Loss & Take Profit
Paper Trading
PREREQUISITES
Basic knowledge of Python and Python libraries such as Pandas. The knowledge of financial markets such as placing orders to buy and sell assets will be helpful.
SYLLABUS
Introduction
Backtesting helps to evaluate a trading strategy from different perspectives. The interactive methods used will help you not only grasp the concepts but also answer all questions related to backtesting. This section helps you understand the course structure, and the various teaching tools used in the course: videos, quizzes, coding exercises and also the capstone project.
Introduction 4m 43s
Course Structure 10m
Quantra Features and Guidance 4m 10s
Backtesting
With backtesting, we can evaluate any of our trading strategies objectively. In this section, you will familiarise yourself with the complete process of backtesting. And you will also explore the key difference between backtesting and simulation.
What is Backtesting? 2m 22s
Does Past Reflect Future? 2m
Backtesting Technique 2m
Backtesting vs Simulation 4m 57s
Simulated Data 2m
Generate Simulated Data 2m
Dataset for Backtest 2m
When to Use Simulated Data? 2m
Best Approach to Backtesting 2m
Backtesting Process 2m 21s
Steps in Backtesting 2m
Evaluate the Performance of Backtesting 2m
Need for Backtesting 2m
Drawbacks of Backtesting 2m
Additional Reading 10m
Financial Data
The very first step to backtesting any trading strategy is to get the right data. In this section, you will learn about the different types of financial data that are available. You will also learn to fetch and store the correct data from various web resources. And lastly, you will understand the limitations of working with financial data.
Financial Data
Structured Financial Data 2m
Frequency of the Data 2m
Derivatives Data 2m
Data for Long-term Strategies 2m
Macroeconomic Data 2m
Use of Sentiment Data 2m
Financial Data Storage 4m 28s
Storage Technique – I 2m
Storage Technique – II 2m
Ideal Storage Method 2m
How to Use Jupyter Notebook? 1m 54s
Daily Stock Price Data 5m
Adjusted Data 2m
How to Use Interactive Exercises? 5m
Fetch the Daily Stock Price Data 5m
Limitations of Financial Data 4m 15s
Key Limitation 2m
Overcome the Limitation 2m
Additional Reading 10m
Data Pre-Processing
Validating the data and performing sanity checks is yet another important step in the backtesting process that must not be overlooked. In this section, you will touch upon some techniques that can be used to validate your dataset. You will also learn about the concept of survivorship bias and ways to overcome this challenge.
Data Pre-Processing 3m 56s
Data Pre-Processing Steps 2m
Data Quality Checks 2m
Discrepancies in Data 2m
Data Quality Checks and Data Cleaning 10m
Check for NaN Values 5m
Drop Missing Values 5m
Identify Duplicate Values 5m
Drop Duplicate Values 5m
Survivorship Bias 4m 33s
Survivorship Bias and Trading 2m
Overcome Survivorship Bias 2m
Additional Reading 10m
Test on Creation of a Backtest 10m
Trading Rules
To build a strategy, it’s necessary to have an idea and formulate rules based on these ideas. In this section, you will learn how an idea is converted into the entry and exit rules. These rules act as the foundation for the strategy, you will also learn how they are used to generate trading signals.
Developing Trading Rules 2m 2s
Define Trading Rules 2m
Identify Characteristics of Trading Rules 2m
Identify Trading Rules 2m
Implementing a Trading Strategy 2m
Rule Formulation 2m
Identify the Correct Rule 2m
Entry and Exit Rule 3m 22s
Need for Backtesting 2m
Generate Entry and Exit Signals 10m
Short-Term Moving Average 5m
Trading Signals 5m
Strategy Returns 5m
Backtest and Generate Trade Sheet 10m
Long Crossover Condition 2m
Trade Information of a Long Entr 2m
PnL of Long Trades 5m
Trade Level Analytics
To understand whether your strategy is working, you need to analyse certain metrics. Trade level analytics are computations that depict how well the strategy has performed over a certain period of time. In this section, you will be learning how to calculate and interpret a few widely used analytics.
Trade Level Analytics I 5m
Trade Level Analytics II 4m 21s
Define Win Trades 2m
Calculate Win/Loss Rate 2m
Calculate Average PnL Per Trade 2m
Identify the Correct Strategy-I 2m
Identify the Correct Strategy-II 2m
Limitations of Win Trade 2m
Calculate Average Trade Duration 2m
Interpret the Profit Factor 2m
Calculate the Profit Factor 2m
Trade Level Analytics 10m
Average PnL Per Trade 5m
Limitations of Profit Factor 2m
Win Percentage 5m
Average Trade Duration 5m
Analyse the Strategy Performance 2m
Additional Reading 10m
Performance Metrics
The performance of a strategy is determined not only by its returns but also, by its risk. In this section, you will learn how to evaluate the performance of your strategy based on returns, risk and both. You will learn about some key performance metrics such as Sharpe ratio, CAGR, and maximum drawdown, as well as how to compute and implement them in Python using the Jupyter notebook.
Equity Curve and CAGR 3m 53s
Equity Curve 2m
Equity Curve Interpretation 2m
CAGR Calculation 2m
CAGR and Average Annual Return 2m
Strategy Returns 2m
Sharpe Ratio 2m 10s
Sharpe Ratio of a Strategy 2m
Sharpe Ratio Calculation 2m
Strategy Comparison 2m
Drawback of Sharpe Ratio 2m
Maximum Drawdown 2m 27s
Maximum Drawdown Calculation 2m
Maximum Drawdown Comparison 2m
Maximum Drawdown of a Strategy 2m
Performance Metrics 10m
FAQ on Cumulative Returns 2m
CAGR 5m
Sharpe Ratio 5m
Maximum Drawdown 5m
Additional Reading 10m
Risk Management
Risk management is one of the key elements of a trading strategy. The performance of a trading strategy can be improved with the help of risk management. In this section, you will be learning how to bring down the level of risk of your strategy by applying methods like stop-loss and take-profit levels. You will learn how these levels protect you from extreme losses.
Stop-Loss and Take-Profit 5m
Control the Trading Losses 2m
Applying Risk Management 2m
Risk Management of a Long Trade 2m
Need for Stop-Loss and Take-Profit 2m
Guidelines For Setting Stop-Loss and Take-Profit 3m 27s
Correct Stop-Loss and Take-Profit 2m
Risk Management Parameters 2m
Stop-Loss and Take-Profit Orders 2m
Backtest With Stop-Loss and Take-Profit 10m
Stop-Loss of Long Trades 5m
Take-Profit of Long Trades 5m
Additional Reading 10m
Transaction Costs and Slippage
The journey towards building a good backtest for a strategy idea is incomplete without considering the transaction costs and slippages. In simple words, transaction costs encompass brokerage, commission, etc. Slippage is the difference between the expected and executed price. Learn these concepts and understand how to incorporate them into your backtesting code.
Transaction Costs and Slippage 3m 4s
Calculation of Transaction Cost 2m
Calculation of Slippage 2m
Implementation of Transaction Cost and Slippage 10m
Additional Reading 10m
Paper Trading
Once you have built your backtest and are satisfied with the performance of your strategy, you can move to the next step, paper trading. Paper trading has evolved from simple writing of buy and sell prices on a notepad to a full-fledged system environment which replicates the live trading environment. Learn the importance of paper trading and how it strengthens your confidence in the strategy.
Introduction to Paper Trading 4m 5s
Decrease in Performance During Paper Trading 2m
Sharpe Ratio in Paper Trading 2m
Cost Difference Between Backtesting and Paper Trading 2m
Things to Keep in Mind While Paper Trading 3m 17s
Reasons for Paper Trading 2m
Asset Difference in Paper Trading 2m
Change in Entry Rules in Paper Trading 2m
Reasons to Stop Paper Trading 2m
Reason to Move From Paper to Live Trading 2m
Additional Reading 10m
Test on Evaluation of Strategy 12m
Live Trading on Blueshift
Learn how you can take your backtested strategy live with some important steps. Learn about the code structure, the various functions used to create a strategy, and finally, paper or live trade on Blueshift.
Section Overview 2m 19s
Live Trading Overview 2m 41s
Vectorised vs Event Driven 2m
Process in Live Trading 2m
Real-Time Data Source 2m
Blueshift Code Structure 2m 57s
Important API Methods 10m
Schedule Strategy Logic 2m
Fetch Historical Data 2m
Place Orders 2m
Backtest and Live Trade on Blueshift 4m 5s
Additional Reading 10m
Blueshift Data FAQs 10m
Live Trading Template
This section includes a template of a trading strategy that can be used on Blueshift. This live trading strategy template uses moving average crossover to generate entry and exit signals. You can tweak the code by changing securities or the strategy parameters. You can also analyse the strategy performance in more detail.
Paper/Live Trade Using Moving Averages 10m
FAQs for Live Trading on Blueshift 5m
Common Pitfalls in Backtesting
There exist various biases in Backtesting which include look-ahead, overfitting, and data snooping biases. Learn how to overcome them, and check out the common mistakes while backtesting. Finally, even if your strategy is successful and has been validated by backtesting it, you can never over-rely on it. We explain this with the help of a real-life case study.
Biases to Avoid 4m 7s
Examples of Look Ahead Bias 2m
Paper Trading Based on Exceptional Returns 2m
Example of Overfitting 2m
Common Mistakes Done With Trading Volume 3m 19s
Number of Shares Bought on Basis of Volume 2m
Definition of Illiquid Stock 2m
Trading Based on Volume 2m
Strategy Decision Using Volume 2m
Data Snooping 3m 43s
Example of Data Snooping 2m
Minimisation of Data Snooping 2m
Multiple Iterations on Out of Sample Data 2m
Strategy Performance on In Sample and Out of Sample Data 2m
Over Reliance on Backtesting 2m 12s
Reason of High Leverage in Trading 2m
Possible Flaw in Strategy Idea 2m
Reason for Not Over Relying on Backtesting 2m
Minimise Effect of Extreme Events on Portfolio 2m
Additional Reading 10m
FAQs
In this section, we address some of the most frequently asked questions about backtesting.
Ideal Time Period for Backtesting 2m
Number of Assets to Backtest On 2m 24s
Risk Metrics and Sharpe Ratio 3m 1s
Paper and Live Trading 3m 48s
Capstone Project
This section will help you to develop a moving average crossover strategy and backtest it. You will also create an equal-weighted portfolio and compute its performance metrics.
Capstone Project: Getting Started 10m
Problem Statement 10m
Frequently Asked Questions 10m
Code Template and Data Files 2m
Capstone Project Model Solution 10m
Capstone Solution Downloadable 2m
Run Codes Locally on Your Machine
In this section, you will learn to install the Python environment on your local machine. You will also learn about some common problems while installing python and how to troubleshoot them.
Python Installation Overview 2m 18s
Flow Diagram 10m
Install Anaconda on Windows 10m
Install Anaconda on Mac 10m
Know your Current Environment 2m
Troubleshooting Anaconda Installation Problems 10m
Creating a Python Environment 10m
Changing Environments 2m
Quantra Environment 2m
Troubleshooting Tips for Setting Up Environment 10m
How to Run Files in Downloadable Section? 10m
Troubleshooting for Running Files in Downloadable Section 10m
Course Summary
In this section, we will briefly summarise everything that you have learned in this course.
Summary 2m
Course Summary and Next Steps 2m
Python Codes and Data 2m
ABOUT AUTHOR
QuantInsti®
QuantInsti is the world’s leading algorithmic and quantitative trading research & training institute with registered users in 190+ countries and territories. An initiative by founders of iRage, one of India’s top HFT firms, QuantInsti has been helping its users grow in this domain through its learning & financial applications based ecosystem for 10+ years.
WHY QUANTRA®?
Gain more in less time
Get taught by practitioners
Learn at your own pace
Get data & strategy models to practice on your own