OPEN-SOURCE SCRIPT

Vortex Trend Crossover [RC Tools]

337
RC Tools — Vortex Trend Crossover
────────────────────────────────────────────────────────────────────

█ OVERVIEW

Most directional-movement tools measure how far price has moved from a fixed baseline. The Vortex Indicator, developed by Etienne Botes and Douglas Siepman, asks a more specific question: how far did today's price action "reach" away from where it just was, in each direction? That reach, summed over a window and compared between up and down, is what drives this tool's crossover signal.

█ WHAT IT DOES

Computes two oscillating lines, VI+ and VI-, from how far each bar's high and low reach past the prior bar's opposite extreme, and classifies each confirmed bar as Bullish or Bearish based on which line is currently dominant. Colours the chart background accordingly, plots both the smoothed and raw VI+/VI- lines in a dedicated pane against the 1.0 baseline, and shows a table with the live (intrabar) and confirmed vote side by side, plus how long price has been in the current state.

█ THE THEORY BEHIND IT

Most directional tools compare price to itself over time (a moving average) or measure the net displacement of directional movement (DMI). Vortex instead asks how far each bar reaches beyond where the market just was, using the opposite extreme of the prior bar as the reference point: today's high against yesterday's low for upward reach, today's low against yesterday's high for downward reach. Normalising both by the true range and summing over a window produces two lines, VI+ and VI-, that oscillate around a baseline of 1.0. When VI+ is meaningfully above VI-, upward reach has been dominating; when VI- takes over, downward reach has. The crossover between the two lines is the signal.

█ HOW IT IS CALCULATED

1. VM+ = |high − low[1]| (today's high vs. yesterday's low — upward reach). VM− = |low − high[1]| (today's low vs. yesterday's high — downward reach).
2. TR = true range for the bar.
3. Sum VM+, VM−, and TR separately over the VI Length window, then divide: VI+ = ΣVM+ / ΣTR, VI− = ΣVM− / ΣTR.
4. Optionally smooth VI+ and VI− (the raw sums are noisy bar-to-bar by construction).
5. When smoothed VI+ crosses above smoothed VI−, the state flips to Bullish. When it crosses below, the state flips to Bearish. Between crossovers, the classification holds.

Classification occurs ONLY on confirmed bar close — the plotted VI+/VI-, the background colour and the table all update together, so nothing here can disagree mid-bar or flip back and forth as the current bar forms.

█ SETTINGS & CONFIGURATION

• VI Length (default 14) — the summation window for VI+ and VI-
• Smoothing Length and Type (default 5-period EMA) — reduces the raw VI+/VI- sums' bar-to-bar noise before the crossover check
• Table visibility, position and colours are fully configurable; the main-chart background painting can be toggled off if you only want the statistics pane

█ HOW TO USE IT

Use it as a directional-pressure filter alongside your existing tools, not as a standalone entry signal. Because it's a crossover system, it tends to behave like other crossover tools — reliable in trending conditions, prone to whipsaw when the two lines sit close together in a range. The Live row can still change until the bar closes; only the Confirmed row is safe to treat as settled.

Works on any asset and timeframe with sufficient history for the VI Length window.

█ LIMITATIONS

• Vortex is a DIRECTIONAL-PRESSURE oscillator, not a magnitude or overbought/oversold measure. Any use of it as a precision reversal forecast is a misuse.
• Like any crossover-based system, it can whipsaw when VI+ and VI- sit close together in choppy, range-bound conditions.
• The summation window resets its frame of reference every VI Length bars; a short length reacts fast but is noisier, a long length is smoother but slower to reflect a genuine change.
• Smoothing trades responsiveness for fewer false crossovers — there is no setting that eliminates whipsaw entirely.
• This script does NOT repaint. All classification updates on confirmed bar close only.

█ DISCLAIMER

For educational and informational purposes only. Nothing here is financial advice. Past behaviour of any directional state does not indicate future results. Trade at your own risk.

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน