דלגו לתוכן
פתיחת RaamTrade

VortexIndicator — Vortex Indicator

תוכן זה אינו זמין עדיין בשפה שלך.

Two lines measuring upward and downward swing movement, each normalised by true range. The crossing of +VI and −VI marks a trend change; the distance between them is its conviction.

Signature

VortexIndicator(period, on=<source>)
Argument Type Required Notes
period int Param or literal Yes Window. Default 14, bounds 1–400.
on= symbol No Source symbol. Defaults to the trade symbol. Reads high, low, close.

Formula

$$ VM^{+} = |H_t - L_{t-1}|, \quad VM^{-} = |L_t - H_{t-1}| $$ $$ VI^{+} = \frac{\sum_n VM^{+}}{\sum_n TR}, \quad VI^{-} = \frac{\sum_n VM^{-}}{\sum_n TR} $$

Warmup

period + 1 bars; both lines read 1.0 until then, and on a zero-range window.

Reading the value

vi.vi_plus
vi.vi_minus
vi.vi_plus > vi.vi_minus

Multi-value: cannot be chained onto or crossed — compare the two outputs directly.

Example

class VortexCross(Strategy):
"""Long while +VI leads −VI."""
period = Param(14, min=1, max=400)
trade = Symbol()
sizing = FixedCapital()
def execute(self):
vi = VortexIndicator(self.period, on=self.trade)
if vi.vi_plus > vi.vi_minus and self.trade.is_flat:
self.buy(self.trade, reason=f"+VI {vi.vi_plus:.2f} over -VI {vi.vi_minus:.2f}")
if vi.vi_plus < vi.vi_minus and self.trade.is_long:
self.sell(self.trade, self.trade.position, reason="Vortex flipped")

Notes

  • Etienne Botes and Douglas Siepman, TASC (2010).
  • Proven by an assert-via-trade run on SPY daily (both lines matched a strategy-side reference to 1e-3 on every bar; zero alarm trades).
  • Both lines hover around 1.0; readings far above 1 mean one side is dominating the range.