Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn Algorithmic Trading

You're reading from   Learn Algorithmic Trading Build and deploy algorithmic trading systems and strategies using Python and advanced data analysis

Arrow left icon
Product type Paperback
Published in Nov 2019
Publisher Packt
ISBN-13 9781789348347
Length 394 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Sebastien Donadio Sebastien Donadio
Author Profile Icon Sebastien Donadio
Sebastien Donadio
Sourav Ghosh Sourav Ghosh
Author Profile Icon Sourav Ghosh
Sourav Ghosh
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Section 1: Introduction and Environment Setup FREE CHAPTER
2. Algorithmic Trading Fundamentals 3. Section 2: Trading Signal Generation and Strategies
4. Deciphering the Markets with Technical Analysis 5. Predicting the Markets with Basic Machine Learning 6. Section 3: Algorithmic Trading Strategies
7. Classical Trading Strategies Driven by Human Intuition 8. Sophisticated Algorithmic Strategies 9. Managing the Risk of Algorithmic Strategies 10. Section 4: Building a Trading System
11. Building a Trading System in Python 12. Connecting to Trading Exchanges 13. Creating a Backtester in Python 14. Section 5: Challenges in Algorithmic Trading
15. Adapting to Market Participants and Conditions 16. 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:
...
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 AU $24.99/month. Cancel anytime