The Rate of Change Indicator. Another View on Momentum.
Coding the Known Rate of Change Indicator in Python.
Momentum has many angles and can be measured in many ways. Also, many strategies can be elaborated on this great concept. In this article, we will discuss a famous momentum indicator called the rate of change and then see how it can be used in two different strategies, mean-reversion and momentum flip.
I have just released a new book after the success of my previous one “The Book of Trading Strategies”. It features advanced trend-following indicators and strategies with a GitHub page dedicated to the continuously updated code. Also, this book features the original colors after having optimized for printing costs. If you feel that this interests you, feel free to visit the below Amazon link, or if you prefer to buy the PDF version, you could contact me on LinkedIn.
The Rate Of Change
The rate of change of a security can be found by using the below formula:
It describes the evolution of the value over time. If the previous price of a security was $100 and is now $110, then the rate of change will be 10%. This means that the market price increased by 10% since the previous period.
The Rate of Change Indicator is an oscillator that uses the above formula on a rolling basis and for a specified lookback period. A lookback period of 3 means that we will calculate the rate of change between the current price and the price 3 periods ago. The below plot shows an example of a 10-period lookback.
To code the Rate of Change Indicator in Python, we can use the following function:
def roc(Data, lookback, what, where):
Data = adder(Data, 1)
for i in range(len(Data)):
Data[i, where] = ((Data[i, what] - Data[i - lookback, what]) / Data[i - lookback, what]) * 100
return Data
Let us now see how we can use this simple indicator to find trading strategies.
Strategy #1: Mean-Reversion
Mean-reversion is the concept of whenever the market price makes a move, it is expected to revert back to its mean. This means that it is a contrarian strategy that seeks to fade strong extended moves in order to stabilize the market. The ROC indicator is unbounded and therefore the barriers are dependent on the trader’s discretion.
Remember that a security can remain in overbought/oversold zones for a long time before exiting and even when it exits, the price change will be negative relative to the expected movement of when the breach has started. We can actually modify a saying of John Maynard Keynes to be the following:
“The market can stay in overbought/oversold zone longer than you can stay solvent.”
The original quote is: The market can stay irrational longer than you can stay solvent.
If you are also interested by more technical indicators and strategies, then my book might interest you:
Strategy #2: Momentum Change
A flip happens whenever the Momentum changes side from negative to positive and vice versa. By momentum, we are referring to the ROC indicator. Here is the idea below:
When the ROC indicator flips positive after having been below zero, it is a sign that momentum is turning bullish and therefore, a bullish signal can be generated.
When the ROC indicator flips negative after having been above zero, it is a sign that momentum is turning bearish and therefore, a bearish signal can be generated.
Conclusion
Remember to always do your back-tests. You should always believe that other people are wrong. My indicators and style of trading may work for me but maybe not for you.
I am a firm believer of not spoon-feeding. I have learnt by doing and not by copying. You should get the idea, the function, the intuition, the conditions of the strategy, and then elaborate (an even better) one yourself so that you back-test and improve it before deciding to take it live or to eliminate it. My choice of not providing specific Back-testing results should lead the reader to explore more herself the strategy and work on it more.
To sum up, are the strategies I provide realistic? Yes, but only by optimizing the environment (robust algorithm, low costs, honest broker, proper risk management, and order management). Are the strategies provided only for the sole use of trading? No, it is to stimulate brainstorming and getting more trading ideas as we are all sick of hearing about an oversold RSI as a reason to go short or a resistance being surpassed as a reason to go long. I am trying to introduce a new field called Objective Technical Analysis where we use hard data to judge our techniques rather than rely on outdated classical methods.
One Last Word
I have recently started an NFT collection that aims to support different humanitarian and medical causes. The Society of Light is a set of limited collectibles which will help make the world slightly better as each sale will see a percentage of it sent directly to the charity attributed to the avatar. As I always say, nothing better than a bullet list to outline the benefits of buying these NFT’s:
High-potential gain: By concentrating the remaining sales proceedings on marketing and promoting The Society of Light, I am aiming to maximize their value as much as possible in the secondary market. Remember that trading in the secondary market also means that a portion of royalties will be donated to the same charity.
Art collection and portfolio diversification: Having a collection of avatars that symbolize good deeds is truly satisfying. Investing does not need to only have selfish needs even though there is nothing wrong with investing to make money. But what about investing to make money, help others, and collect art?
Donating to your preferred cause(s): This is a flexible way of allocating different funds to your charities.
A free copy of my book in PDF: Any buyer of any NFT will receive a free copy of my latest book shown in the link of the article.