indicator · own pane · open source
Vortex Indicator
Running…
Loading chart…
About
Vortex Indicator (+VI / -VI): two oscillators built from the sum of up-moves and down-moves over a window, normalised by the true range.
- +VI crossing above -VI = fresh uptrend; the opposite = fresh downtrend.
- Crossovers close to 1.0 are strongest; divergence with price flags weakness.
- Pairs well with ADX — Vortex picks direction, ADX confirms strength.
Source code
//@version=5
indicator("Vortex Indicator", overlay=false)
len = input.int(14, "Length", minval=2)
tr = math.max(high - low, math.abs(high - close[1]), math.abs(low - close[1]))
vip = math.sum(math.abs(high - low[1]), len) / math.sum(tr, len)
vim = math.sum(math.abs(low - high[1]), len) / math.sum(tr, len)
hline(1, "Equilibrium", color=color.gray, linestyle=hline.style_dashed)
p_Plus_VI = plot(vip, "Plus VI", color=color.green, linewidth=2)
p_Minus_VI = plot(vim, "Minus VI", color=color.red, linewidth=2)
alertcondition(ta.crossover(vip, vim), "Bullish VI cross", "+VI crossed above -VI")
alertcondition(ta.crossunder(vip, vim), "Bearish VI cross", "+VI crossed below -VI")
No comments yet.
Sign in to comment.