# Trading With Momentum and Volatility

## Creating and Coding the Filtered Momentum Indicator

Momentum is an interesting concept in financial time series. Most strategies are either trend-following or mean-reverting. Momentum is the strength of the acceleration to the upside or to the downside, and if we can measure precisely when momentum has gone too far, we can anticipate reactions and profit from these short-term reversal points. One way to measure momentum is by the momentum indicator.

The idea of this article is to code the momentum indicator and then create volatility bands around it to make it bounded. This should give trading ideas whenever the indicator touches its upper or lower volatility band.

I have released a new book after the success of my previous one “*Trend Following Strategies in Python*”. It features advanced contrarian indicators and strategies with a **GitHub **page dedicated to the continuously updated code. If you feel that this interests you, feel free to visit the below Amazon link (which contains a sample), or if you prefer to buy the PDF version, you could check the link at the end of the article.

# The Momentum Indicator

The momentum indicator’s formula is extremely simple and can be summed up in the below mathematical representation:

What the above says is that we can divide the latest (or current) closing price by the closing price of a previous selected period, then we multiply by 100. Hence, if we say we are going to use momentum(14), then, we will subtract the current values from the values 14 periods ago and then divide by 100.

The momentum indicator is not bounded as can be seen from the formula, which is why we need to form a strategy that can give us signals from its movements.