The Relative Vigor Index. Coding & Trading in Python.
Coding the Relative Vigor Index in Python.
--
Another famous and relatively complex indicator will be discussed in this article. It is a contrarian oscillator that is best used in ranging markets. I am of course talking about the relative vigor index.
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 Building Blocks of the Relative Vigor Index
The Relative Vigor Index is composed of many building blocks, namely the totality of OHLC data and moving averages. It seeks to measure the strength of the trend by comparing the ranges between the open/close and high/low values.
It is an unbounded indicator that oscillates around the zero line with many strategies possible to be formed using it, namely divergences and crosses. The numerator line of the Relative Vigor can be calculated this way:
- Calculate the current difference between the closing and opening price. Let’s call this variable A.
- Calculate the difference between the current closing price and the opening price two periods ago. Let’s call this variable B. Multiply the result by 2.
- Calculate the difference between the current closing price and the opening price three periods ago. Let’s call this variable C. Multiply the result by 2.
- Calculate the difference between the current closing price and the opening price four periods ago. Let’s call this variable D.