Momentum Trading Strategy implemented in Python on a 500 Stocks universe [Beginner friendly]

Published on September 22, 2022

Search Popular Articles Top Searched Momentum Trading Outpost, Momentum Trading Strategy implemented in Python on a 500 Stocks universe [Beginner friendly].


In this video we are constructing a momentum trading strategy in Python.
First we are pulling ticker symbols which are currently in the S&P 500 and also take care of added and removed stocks diminishing survivorship bias.
Then we are pulling prices for those ticker symbols and calculate monthly returns (I am also recapping how cumulating returns are working). We are then cumulating returns over the last n months (12 in the first place) and check for the top performing stocks over this time horizon. The top performers performance is the performance over the upcoming month so we are screen the monthly returns for the winning stocks and do that for every single month in our observation period.

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

Want more trading strategies? Please let me know but liking this video and subscribing to the channel.

Video on how (stock) returns are calculated:

Previous Momentum videos:

Momentum on Dow:

Momentum on Cryptocurrencies:

wiki link:

Further reading:

Momentum is a hot topic in academics as there is empirical evidence that this strategy is working but there is a discussion about WHY this strategy is working.

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

00:00 – 00:49 Introduction / Strategy
00:49 – 08:34 Getting bias free S&P500 ticker symbols
08:34 – 10:18 Pulling stock price data for the symbols
10:18 – 11:20 Sharing some thoughts (skippable)
11:20 – 12:52 Data manipulations (merging/renaming)
12:52 – 16:53 RECAP: How to cumulate returns (step by step)
16:53 – 18:05 Calculate monthly returns
18:05 – 19:03 Raw price monthly return calculation (just to make it clear)
19:03 – 20:42 Calculating past 12 month returns
20:42 – 22:15 Understand the logic calculating the winner portfolio
22:15 – 25:39 Winner portfolio calculation on a single row
25:39 – 30:45 Wrapping everything into a function
30:45 – 32:32 Discussing the outcome / some amendments
32:32 – 33:20 Benchmark comparison
33:20 – 35:21 Some chatting /shorting losers / Thx for watching 🙂

#Python #Trading #Momentum #Backtest

Momentum Trading Strategy implemented in Python on a 500 Stocks universe [Beginner friendly], Momentum Trading Outpost

Momentum Trading Outpost, Momentum Trading Strategy implemented in Python on a 500 Stocks universe [Beginner friendly].


Just how do we determine Momentum?

Researchers determine Momentum Trader by multiplying the mass of the item by the rate of the object. It is an indicator of exactly how difficult it would be to stop the things. If you were running, you might have a mass of 50 kilograms and a velocity of 10 meters per second west (really quick).

Nevertheless, the concept was obscured as well as left inactive following the growth and also popularisation of value investing theory from the 1930s onward. Financiers would concentrate extra on the inherent, or “essential,” value of a possession, and less on the trajectory of the movement of its price.

Complying with a renaissance of technical analysis later on in the century, the principle of Momentum investing enjoyed a rebirth with the magazine of a study by Jegadeesh as well as Titman in 1993. It revealed that investors and markets tended to provide favorable responses to recent info regarding possession prices, thus reinforcing price trends as they hold.

Relative Momentum And Also Outright Momentum.

Momentum trading can be classified in two classifications: Closely Equal Momentum and also outright Momentum.

Relative Momentum strategy is where the efficiency of different safeties within a certain property course are compared versus each other, and also capitalists will certainly favour getting solid doing protections and offering weak carrying out safeties.
Outright Momentum approach is where the behaviour of the price of a safety is compared versus its previous efficiency in a historical time series.
In money trading, either Closely Equal or absolute Momentum can be used. However, Momentum trading strategies are much more regularly related to outright Momentum.

Just how Is A Momentum Method Used?

Momentum can be identified over much longer periods of weeks or months, or within day-trading time frames of mins or hours.

The primary step traders customarily take is to establish the direction of the trend in which they wish to trade. Making use of among a number of Momentum signs offered, they may then seek to establish an entry point to get (or sell) the asset they are trading. They will likewise wish to establish a profitable and affordable departure factor for their profession based on projected as well as formerly observed levels of assistance and also resistance within the market.

Additionally, they are suggested to set stop-loss orders above or listed below their trade entrance point– relying on the direction of the trade. This remains in order to guard against the possibility of an unexpected price-trend turnaround as well as unwanted losses.

Get Interesting Vids Explaining Momentum Trading Outpost and Financial market news, evaluation, trading signals and Foreign exchange investor evaluations.

Risk Notice:

All products listed on our website are traded on take advantage of, which suggests they lug a high level of financial risk and also you can shed greater than your deposits. These products are not appropriate for all financiers. Please guarantee you fully recognize the dangers and meticulously consider your financial scenario and trading experience before trading. Seek independent suggestions if essential.

Enjoyed this video?
"No Thanks. Please Close This Box!"