Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learn Algorithmic Trading

You're reading from  Learn Algorithmic Trading

Product type Book
Published in Nov 2019
Publisher Packt
ISBN-13 9781789348347
Pages 394 pages
Edition 1st Edition
Languages
Authors (2):
Sebastien Donadio Sebastien Donadio
Profile icon Sebastien Donadio
Sourav Ghosh Sourav Ghosh
Profile icon Sourav Ghosh
View More author details

Table of Contents (16) Chapters

Title Page
Copyright and Credits About Packt Contributors Preface Algorithmic Trading Fundamentals Deciphering the Markets with Technical Analysis Predicting the Markets with Basic Machine Learning Classical Trading Strategies Driven by Human Intuition Sophisticated Algorithmic Strategies Managing the Risk of Algorithmic Strategies Building a Trading System in Python Connecting to Trading Exchanges Creating a Backtester in Python Adapting to Market Participants and Conditions Other Books You May Enjoy

Backtesting the dual-moving average trading strategy

The dual-moving average trading strategy places a buy order when the short moving average crosses the long moving average in an upward direction and will place a sell order when the cross happens on the other side. This section will present the backtesting implementation of the dual-moving average strategy. We will present the implementation of a for-loop backtester and an event-based backtester.

For-loop backtester

  1. As regards the implementation of this backtester, we will use the GOOG data by retrieving it with the same function we used previously, load_financial_data. We will follow the pseudo code that we proposed during the previous section:
for each price update:
create_metric_out_of_prices...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}