Algorithmic Trading in Python - Simple Moving Averages & Optimization [Follow Up vid]

Опубликовано: 04 Март 2026
на канале: Algovibes
11,311
354

This video is an extension on the first video on moving averages where we took a look at a crossover strategy.
In this one we are using techniques such as vectorization and trying to find the optimal pair of SMAs.

Get the Notebook/Source code by becoming a Tier-2 Channel member:
   / @algovibes  

The strategy holds an asset when the short term SMA is above the long term SMA and is not holding the asset when the long term SMA is above the short term SMA.
The code is designed in a way that other strategies can be tested as well (e.g. EMA) with some amendments.

If you enjoyed this video or could extract value out of it give it a thumbs up and subscribe to the channel :-)

Video on calculating stock returns:
   • How To Calculate Stock Returns [Excel and ...  

Disclaimer:
This video is not an investment advice and is for educational and entertainment purposes only.

Although this code is deviating this video is inspired by Deepak Kanungo, in specific the vectorized approach (see Chapter 15 Learning Path: Hands-On Algorithmic Trading with Python) and partly the optimization.

0:00 - 01:09 Introduction
01:09 - 01:48 Pulling price data
01:48 - 06:36 Function implementing the strategy (Vectorization)
06:36 - 09:22 Function calculating performance
09:22 - 11:22 Visualizing the strategy
11:22 - 15:04 Optimization: Find the best pair of SMAs for an asset
15:04 - 18:45 Wrapping the optimization in a reproducible function
18:45 - 20:20 Playing around with some assets

#Python #Trading #SMA