Vortex Indicator (VORTEX)
Summary
Vortex Indicator: Etienne Botes and Douglas Siepman's two-line trend indicator (Technical Analysis of Stocks & Commodities 28:1, January 2010). Positive and negative "vortex movement" — the reach from today's high to yesterday's low and from today's low to yesterday's high — each summed over the period and normalized by the summed true range.
A +VI line crossing above −VI is the bullish signal the authors describe; the two lines are conventionally plotted together.
Chart
Chart metadata i
Outputs
outPlusVI:line·zero·positiveoutMinusVI:line·zero·positive
Formula
Per bar, TR[i] = max(H[i]−L[i], |C[i−1]−H[i]|, |C[i−1]−L[i]|) (exactly TRANGE), VMP[i] = |H[i] − L[i−1]| and VMM[i] = |L[i] − H[i−1]|. Then +VI = SUM(VMP, n) / SUM(TR, n) and −VI = SUM(VMM, n) / SUM(TR, n).
No smoothing, no recursion, no seeding — three rolling sums over per-bar terms. Every source (the original TASC article, StockCharts, Wikipedia, TradingView) states the identical formula; the only cross-source difference is the suggested period (14 vs Wikipedia's worked 21). A window whose every bar is flat sums the true range to zero; both lines then emit 0.0, the convention the external implementations share.
Inputs
inHigh— High price seriesinLow— Low price seriesinClose— Close price series
Outputs
outPlusVI— Positive vortex line (+VI)outMinusVI— Negative vortex line (−VI)
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 14 | 1–100000 | Number of bars in the rolling sums |
Notes
- Bar 0 has no term (all three need a prior bar) and is consumed exactly as
TRANGEconsumes it, so the first output sits at indexoptInTimePeriod, notoptInTimePeriod − 1. - Not start-dependent: each output depends only on the finite trailing window. No unstable period.
Properties
Numerical Stability: Start-Independent
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ☐ Display Shift |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
| ☐ Uses Transcendental |
| ☐ Input Must Be Positive |
Example
#include <stdio.h>
#include <ta_libc.h>
int n = 252;
double high[252]; /* your data, oldest first */
double low[252]; /* your data, oldest first */
double close[252]; /* your data, oldest first */
double plusVi[252], minusVi[252];
int outBegIdx, outNBElement;
TA_Initialize();
TA_VORTEX( 0, n - 1, high, low, close, 14, &outBegIdx, &outNBElement, plusVi, minusVi );
printf( "%d values from bar %d:\n", outNBElement, outBegIdx );
printf( "plusVi = [%.4f, ..., %.4f]\n", plusVi[0], plusVi[outNBElement - 1] );
printf( "minusVi = [%.4f, ..., %.4f]\n", minusVi[0], minusVi[outNBElement - 1] );use ta_lib::Core;
let high = vec![0.0; 252]; // your data, oldest first
let low = vec![0.0; 252]; // your data, oldest first
let close = vec![0.0; 252]; // your data, oldest first
let mut plus_vi = vec![0.0; 252];
let mut minus_vi = vec![0.0; 252];
let core = Core::new();
let range = core.vortex(0, high.len() - 1, &high, &low, &close, 14,
&mut plus_vi, &mut minus_vi)?;
println!("{} values from bar {}:", range.count, range.beg_idx);
println!("plus_vi = [{:.4}, ..., {:.4}]", plus_vi[0], plus_vi[range.count - 1]);
println!("minus_vi = [{:.4}, ..., {:.4}]", minus_vi[0], minus_vi[range.count - 1]);import io.github.talib.Core;
import io.github.talib.OutRange;
import java.util.Locale;
double[] high = new double[252]; // your data, oldest first
double[] low = new double[252]; // your data, oldest first
double[] close = new double[252]; // your data, oldest first
double[] plusVi = new double[252];
double[] minusVi = new double[252];
Core core = Core.DEFAULT;
OutRange r = core.vortex(0, high.length - 1, high, low, close, 14, plusVi, minusVi);
System.out.printf(Locale.ROOT, "%d values from bar %d:%n", r.count(), r.begIdx());
System.out.printf(Locale.ROOT, "plusVi = [%.4f, ..., %.4f]%n", plusVi[0], plusVi[r.count() - 1]);
System.out.printf(Locale.ROOT, "minusVi = [%.4f, ..., %.4f]%n", minusVi[0], minusVi[r.count() - 1]);using System;
using TALib;
var high = new double[252]; // your data, oldest first
var low = new double[252]; // your data, oldest first
var close = new double[252]; // your data, oldest first
var plusVi = new double[252];
var minusVi = new double[252];
var core = Core.Default;
OutRange r = core.Vortex(0, high.Length - 1, high, low, close, 14, plusVi, minusVi);
Console.WriteLine($"{r.Count} values from bar {r.BegIdx}:");
Console.WriteLine(FormattableString.Invariant($"plusVi = [{plusVi[0]:F4}, ..., {plusVi[r.Count - 1]:F4}]"));
Console.WriteLine(FormattableString.Invariant($"minusVi = [{minusVi[0]:F4}, ..., {minusVi[r.Count - 1]:F4}]"));import { vortex } from 'ta-lib';
const high = new Float64Array(252); // your data, oldest first
const low = new Float64Array(252); // your data, oldest first
const close = new Float64Array(252); // your data, oldest first
const { begIdx, outPlusVi, outMinusVi } = vortex({ high, low, close }, {
timePeriod: 14,
});
console.log(outPlusVi.length + ' values from bar ' + begIdx + ':');
console.log('outPlusVi = [' + outPlusVi[0].toFixed(4) + ', ..., ' + outPlusVi[outPlusVi.length - 1].toFixed(4) + ']');
console.log('outMinusVi = [' + outMinusVi[0].toFixed(4) + ', ..., ' + outMinusVi[outMinusVi.length - 1].toFixed(4) + ']');import (
"fmt"
"log"
talib "ta-lib.github.io/go"
)
high := make([]float64, 252) // your data, oldest first
low := make([]float64, 252) // your data, oldest first
close := make([]float64, 252) // your data, oldest first
plusVi := make([]float64, 252)
minusVi := make([]float64, 252)
core := talib.NewCore()
r, err := core.VORTEX(0, len(high)-1, high, low, close, 14, plusVi, minusVi)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%d values from bar %d:\n", r.NBElement, r.BegIdx)
fmt.Printf("plusVi = [%.4f, ..., %.4f]\n", plusVi[0], plusVi[r.NBElement-1])
fmt.Printf("minusVi = [%.4f, ..., %.4f]\n", minusVi[0], minusVi[r.NBElement-1])Implementation
Added in 0.8.1 (ta-lib-python 0.8.1).
TA-Lib Definition: vortex.c · vortex.yaml
| Native | File |
|---|---|
| C | ta_VORTEX.c |
| Rust | vortex.rs |
| Java | Core_VORTEX.java |
| C# | Core_VORTEX.cs |
| TypeScript | vortex.ts |
| Go | vortex.go |
Python: talib.VORTEX (ta-lib-python 0.8.1 or later), see ta-lib-python.
TA-Lib is also available for R and more using a wrapper.
Aliases
Vortex Indicator (VI)
See Also
TRANGE · PLUS_DI · MINUS_DI · ADX
References
- Etienne Botes and Douglas Siepman, "The Vortex Indicator", Technical Analysis of Stocks & Commodities 28:1 (January 2010), pp. 20–30