indicator · own pane · open source
Vortex Difference
Running…
Loading chart…
About
Vortex Difference is +VI minus -VI — a single-line oscillator that goes positive when up-moves dominate and negative when down-moves do.
- Crosses of zero are the cleanest entries.
- Magnitude scales with trend strength; combined with ADX it gives a regime + direction readout.
Source code
//@version=5
indicator("Vortex Difference", 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)
vd = vip - vim
hline(0, "Zero", color=color.gray, linestyle=hline.style_dashed)
p_VI_Diff = plot(vd, "VI Diff", color=vd >= 0 ? color.green : color.red, style=plot.style_columns, linewidth=2)
alertcondition(ta.crossover(vd, 0), "VI diff turns up", "Vortex difference crossed above zero")
alertcondition(ta.crossunder(vd, 0), "VI diff turns down", "Vortex difference crossed below zero")
No comments yet.
Sign in to comment.