OPEN-SOURCE SCRIPT
VortexT

VortexT is an oscillator based on the Vortex Indicator. It measures the strength of upward and downward price movement with two lines, VI+ and VI-, and compares them to show which side dominates the market. On top of that it adds a trend background, a difference histogram and automatic divergence detection.
How It Works
Calculation
VI+ = sum of |high - previous low| over N bars, divided by the sum of the True Range over N bars.
VI- = sum of |low - previous high| over N bars, divided by the sum of the True Range over N bars.
VI+ measures how strongly price pushes up, VI- how strongly it pushes down. Both oscillate around 1.
Chart elements
Green line (VI+) and red line (VI-). With "Dynamic Trend View" enabled, only the dominant line is shown. When the line changes color, a crossover has occurred.
Background. Green when VI+ > VI-, red otherwise.
Histogram. Shows VI+ minus VI-. Above zero (lime) the trend is bullish, below zero (maroon) it is bearish. The height of the columns shows trend strength.
Bull Div / Bear Div. Divergences drawn with a dotted line and a label:
Bear Div: price makes a higher high, but VI+ makes a lower high. The uptrend is losing strength.
Bull Div: price makes a lower low, but VI- makes a lower high. The downtrend is losing strength.
Parameters
Length (14). Lower values give more signals and more noise. Higher values (e.g. 21) give fewer, slower signals.
Pivot Lookback (7). Number of bars on each side used to confirm a pivot.
Max Bars Between Pivots (60). Maximum distance between the two pivots of a divergence.
Show Divergences. Turns divergence lines and labels on or off.
How to Trade It
Long entry
A VI+ crossover above VI- is the base signal: the line turns green, the background turns green and the histogram moves above zero.
Enter only after the candle closes. During the candle the crossover can appear and disappear.
Confirm with the histogram: the columns should grow over the following bars. If it stays flat near zero, the signal is weak.
Confirm with price: it is better to enter when price breaks the high of the crossover candle.
Strongest setup: a Bull Div followed by a bullish crossover. The divergence warns that the downtrend is running out of steam, and the crossover confirms the restart.
Short entry. The mirror image: VI- crossing above VI+, red line, red background, histogram below zero and expanding. The strongest setup is a Bear Div followed by a bearish crossover, entering on a break of the low of the crossover candle.
Exit
Stop loss. For a long, below the low of the crossover candle or below the last swing low. For a short, above the corresponding high. Alternatively use an ATR multiple, especially on very volatile altcoins.
Take profit. A fixed target at R:R 1.5 or 2, or a partial close at 1R with a trailing stop on the rest.
Signal-based exit. Exit or reduce when:
the histogram columns shrink toward zero for several bars, because momentum is fading;
a divergence opposite to your position appears (Bear Div if you are long);
the opposite crossover occurs, which is the definitive exit.
When to Avoid It
Sideways markets. The lines cross constantly, the histogram stays tiny and the indicator produces a chain of false signals. If you see three or four close crossovers with low columns, stay out.
Against the higher-timeframe trend. Use a higher timeframe as a filter, for example trade only longs on the 1H if the 4H is green.
Dislaimer
Not financial advice. This indicator and its description are provided for educational and informational purposes only. Nothing here constitutes investment advice, a recommendation, or an offer to buy or sell any financial instrument. The author is not a licensed financial advisor.
How It Works
Calculation
VI+ = sum of |high - previous low| over N bars, divided by the sum of the True Range over N bars.
VI- = sum of |low - previous high| over N bars, divided by the sum of the True Range over N bars.
VI+ measures how strongly price pushes up, VI- how strongly it pushes down. Both oscillate around 1.
Chart elements
Green line (VI+) and red line (VI-). With "Dynamic Trend View" enabled, only the dominant line is shown. When the line changes color, a crossover has occurred.
Background. Green when VI+ > VI-, red otherwise.
Histogram. Shows VI+ minus VI-. Above zero (lime) the trend is bullish, below zero (maroon) it is bearish. The height of the columns shows trend strength.
Bull Div / Bear Div. Divergences drawn with a dotted line and a label:
Bear Div: price makes a higher high, but VI+ makes a lower high. The uptrend is losing strength.
Bull Div: price makes a lower low, but VI- makes a lower high. The downtrend is losing strength.
Parameters
Length (14). Lower values give more signals and more noise. Higher values (e.g. 21) give fewer, slower signals.
Pivot Lookback (7). Number of bars on each side used to confirm a pivot.
Max Bars Between Pivots (60). Maximum distance between the two pivots of a divergence.
Show Divergences. Turns divergence lines and labels on or off.
How to Trade It
Long entry
A VI+ crossover above VI- is the base signal: the line turns green, the background turns green and the histogram moves above zero.
Enter only after the candle closes. During the candle the crossover can appear and disappear.
Confirm with the histogram: the columns should grow over the following bars. If it stays flat near zero, the signal is weak.
Confirm with price: it is better to enter when price breaks the high of the crossover candle.
Strongest setup: a Bull Div followed by a bullish crossover. The divergence warns that the downtrend is running out of steam, and the crossover confirms the restart.
Short entry. The mirror image: VI- crossing above VI+, red line, red background, histogram below zero and expanding. The strongest setup is a Bear Div followed by a bearish crossover, entering on a break of the low of the crossover candle.
Exit
Stop loss. For a long, below the low of the crossover candle or below the last swing low. For a short, above the corresponding high. Alternatively use an ATR multiple, especially on very volatile altcoins.
Take profit. A fixed target at R:R 1.5 or 2, or a partial close at 1R with a trailing stop on the rest.
Signal-based exit. Exit or reduce when:
the histogram columns shrink toward zero for several bars, because momentum is fading;
a divergence opposite to your position appears (Bear Div if you are long);
the opposite crossover occurs, which is the definitive exit.
When to Avoid It
Sideways markets. The lines cross constantly, the histogram stays tiny and the indicator produces a chain of false signals. If you see three or four close crossovers with low columns, stay out.
Against the higher-timeframe trend. Use a higher timeframe as a filter, for example trade only longs on the 1H if the 4H is green.
Dislaimer
Not financial advice. This indicator and its description are provided for educational and informational purposes only. Nothing here constitutes investment advice, a recommendation, or an offer to buy or sell any financial instrument. The author is not a licensed financial advisor.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.