Vortex Indicator

Introduction

The Vortex Indicator (VI) is designed to identify the strength of trends and potential reversals in the market. Developed by Etienne Botes and Douglas Siepman, the Vortex Indicator consists of two lines: the Positive Vortex Line (+VI) and the Negative Vortex Line (−VI). These lines help traders determine bullish and bearish momentum.

Calculation of the Vortex Indicator

The Vortex Indicator involves several calculations:

  1. Calculate True Range (TR):
mathematical expression or equation
  1. Calculate Positive Vortex (+VI):
mathematical expression or equation
  • UpMove = Current High - Previous Low (only calculated when positive)
  1. Calculate Negative Vortex (-VI):
mathematical expression or equation
  • DownMove = Previous High - Current Low (only calculated when positive)
  1. Calculate Average True Range (ATR):
    • The ATR is often calculated as a moving average of True Range over a specified number of periods.

Example Calculation

Assume we have the following data for a stock over five days:

DayHighLowClose
1302829
2322731
3332930
4323132
5343033

Step 1: Calculate True Range (TR)

  1. Day 2:
    • Current High = 32, Current Low = 27, Previous Close = 29
mathematical expression or equation
  1. Day 3:
    • Current High = 33, Current Low = 29, Previous Close = 31
mathematical expression or equation
  1. Day 4:
    • Current High = 32, Current Low = 31, Previous Close = 30
mathematical expression or equation
  1. Day 5:
    • Current High = 34, Current Low = 30, Previous Close = 32
mathematical expression or equation

Step 2: Calculate UpMove and DownMove

  1. Day 2:

    • UpMove = 32 - 28 = 4 (calculated)
    • DownMove = 0
  2. Day 3:

    • UpMove = 33 - 29 = 4
    • DownMove = 0
  3. Day 4:

    • UpMove = 0
    • DownMove = 1 (31 - 32)
  4. Day 5:

    • UpMove = 4 (34 - 30)
    • DownMove = 0

Step 3: Calculate +VI and -VI

Assuming simple smoothing for this illustration:

  • For example, suppose we achieve averages of +DM and -DM over the period.
  1. Day 2:
mathematical expression or equation mathematical expression or equation
  1. Day 3:
mathematical expression or equation mathematical expression or equation
  1. Day 4:
mathematical expression or equation mathematical expression or equation
  1. Day 5:
mathematical expression or equation mathematical expression or equation

Step 4: Interpretation of Vortex Indicator

  1. Trend Strength:

    • A rising +VI indicates strong upward momentum, while a rising -VI indicates strong downward momentum.
  2. Crossovers:

    • A bullish signal occurs when +VI crosses above -VI, while a bearish signal occurs when -VI crosses above +VI.

Python Code

import pandas as pd

def calculate_true_range(data):
    """Calculate True Range (TR)."""
    data['previous_close'] = data['Close'].shift(1)
    data['high_low'] = data['High'] - data['Low']
    data['high_prev_close'] = (data['High'] - data['previous_close']).abs()
    data['low_prev_close'] = (data['Low'] - data['previous_close']).abs()
    
    # Calculate True Range
    data['True Range'] = data[['high_low', 'high_prev_close', 'low_prev_close']].max(axis=1)
    return data

def calculate_vortex_indicator(data, n=14):
    """Calculate the Vortex Indicator (+VI and -VI)."""
    data = calculate_true_range(data)
    
    # Calculate +DM and -DM
    data['+DM'] = (data['High'].diff() > data['Low'].diff()).where(data['High'].diff() > 0, 0)
    data['-DM'] = (data['Low'].diff() < data['High'].diff()).where(data['Low'].diff() > 0, 0)

    # Calculate the smoothed TR, +DM, and -DM using a rolling window
    data['ATR'] = data['True Range'].rolling(window=n).mean()
    data['+DI'] = 100 * (data['+DM'].rolling(window=n).mean() / data['ATR'])
    data['-DI'] = 100 * (data['-DM'].rolling(window=n).mean() / data['ATR'])

    # Calculate the Vortex Indicator (+VI and -VI)
    data['+VI'] = data['+DI']
    data['-VI'] = data['-DI']

    return data[['Date', 'Close', '+DI', '-DI', '+VI', '-VI']]

Analogy

Think of the Vortex Indicator like two rivers flowing in opposite directions. The +VI represents the river flowing strongly upstream (upward movement), while the -VI represents the river flowing downstream (downward movement). When the upstream river (bullish activity) flows faster than the downstream river (bearish activity), it signifies strong upward momentum. Conversely, when the downstream river flows faster, it indicates bearish momentum. Just as the strength of river currents can indicate the efficiency of transportation, the Vortex Indicator provides insights into market trends.

Conclusion

The Vortex Indicator (VI) is a valuable tool for traders to analyze market strength and identify potential buy and sell signals based on directional movement and volume. By understanding how to calculate and interpret the VI, traders can enhance their trading strategies.


References