OPEN-SOURCE SCRIPT

Swing Trend Analysis

Updated
Introducing the Swing Trend Analyzer: A Powerful Tool for Swing and Positional Trading

The Swing Trend Analyzer is a cutting-edge indicator designed to enhance your swing and positional trading by providing precise entry points based on volatility contraction patterns and other key technical signals. This versatile tool is packed with features that cater to traders of all timeframes, offering flexibility, clarity, and actionable insights.


Key Features:

1. Adaptive Moving Averages:
The Swing Trend Analyzer offers multiple moving averages tailored to the timeframe you are trading on. On the daily chart, you can select up to four different moving average lengths, while all other timeframes provide three moving averages. This flexibility allows you to fine-tune your analysis according to your trading strategy. Disabling a moving average is as simple as setting its value to zero, making it easy to customize the indicator to your needs.

2. Dynamic Moving Average Colors Based on Relative Strength:
This feature allows you to compare the performance of the current ticker against a major index or any symbol of your choice. The moving average will change color based on whether the ticker is outperforming or underperforming the selected index over the chosen period. For example, on a daily chart, if the 21-day moving average turns blue, it indicates that the ticker has outperformed the selected index over the last 21 days. This visual cue helps you quickly identify relative strength, a key factor in successful swing trading.

3. Visual Identification of Price Contractions:
The Swing Trend Analyzer changes the color of price bars to white (on a dark theme) or black (on a light theme) when a contraction in price is detected. Price contractions are highlighted when either of the following conditions is met: a) the current bar is an inside bar, or b) the price range of the current bar is less than the 14-period Average Daily Range (ADR). This feature makes it easier to spot price contractions across all timeframes, which is crucial for timing entries in swing trading.

4. Overhead Supply Detection with Automated Resistance Lines:
The indicator intelligently detects the presence of overhead supply and draws a single resistance line to avoid clutter on the chart. As price breaches the resistance line, the old line is automatically deleted, and a new resistance line is drawn at the appropriate level. This helps you focus on the most relevant resistance levels, reducing noise and improving decision-making.

5. Buyable Gap Up Marker: The indicator highlights bars in blue when a candle opens with a gap that remains unfilled. These bars are potential Buyable Gap Up (BGU) candidates, signaling opportunities for long-side entries.

6. Comprehensive Swing Trading Information Table:
The indicator includes a detailed table that provides essential data for swing trading:

a. Sector and Industry Information: Understand the sector and industry of the ticker to identify stocks within strong sectors.

b. Key Moving Averages Distances (10MA, 21MA, 50MA, 200MA): Quickly assess how far the current price is from key moving averages. The color coding indicates whether the price is near or far from these averages, offering vital visual cues.

c. Price Range Analysis: Compare the current bar's price range with the previous bar's range to spot contraction patterns.

d. ADR (20, 10, 5): Displays the Average Daily Range over the last 20, 10, and 5 periods, crucial for identifying contraction patterns. On the weekly chart, the ADR continues to provide daily chart information.

e. 52-Week High/Low Data: Shows how close the stock is to its 52-week high or low, with color coding to highlight proximity, aiding in the identification of potential breakout or breakdown candidates.

f. 3-Month Price Gain: See the price gain over the last three months, which helps identify stocks with recent momentum.

7. Pocket Pivot Detection with Visual Markers:
Pocket pivots are a powerful bullish signal, especially relevant for swing trading. Pocket pivots are crucial for swing trading and are effective across all timeframes. The indicator marks pocket pivots with circular markers below the price bar:
a. 10-Day Pocket Pivot: Identified when the volume exceeds the maximum selling volume of the last 10 days. These are marked with a blue circle.
b. 5-Day Pocket Pivot: Identified when the volume exceeds the maximum selling volume of the last 5 days. These are marked with a green circle.



The Swing Trend Analyzer is designed to provide traders with the tools they need to succeed in swing and positional trading. Whether you're looking for precise entry points, analyzing relative strength, or identifying key price contractions, this indicator has you covered. Experience the power of advanced technical analysis with the Swing Trend Analyzer and take your trading to the next level.
Release Notes
Release Notes:

This release enhances the information displayed in the information table. Intraday charts now show percentage gains for the past 10, 21, and 63 bars, replacing the previous 3-month gain. Similarly, non-intraday charts now display percentage gains for the past 1, 3, 6, and 9 months. Additionally, intraday charts now include the percentage distance from the 252-bar high and low, while daily charts show the distance from the 52-week high and low.
Release Notes
Release Notes:

This release enhances the information displayed in the information table. Intraday charts now show percentage gains for the past 10, 21, and 63 bars, replacing the previous 3-month gain. Similarly, non-intraday charts now display percentage gains for the past 1, 3, 6, and 9 months. Additionally, intraday charts now include the percentage distance from the 252-bar high and low, while daily charts show the distance from the 52-week high and low.

Removed unnecessary table row.
Release Notes
Release Notes:
Enhanced chart clarity by adding explicit visual markers to highlight indicator features. Removed the red dot indicator for days with a red close and above-average volume to reduce visual clutter.
Release Notes
Fixed Spelling
Release Notes
Updates:

1. The information table now has a transparent background, removing the previous background color for a cleaner look.

2. A new feature has been added to the daily chart to help identify significant stock movements:

a) Purple dot: Appears above the bar when the stock rallies by more than 5%.
b) Red dot: Appears above the bar when the stock drops by more than 5%.


These indicators aim to quickly highlight key stock behaviors:
a) If a stock shows several purple dots in its history, it suggests the stock is highly volatile or "explosive," meaning it has the potential for rapid movements.

b) If a cluster of purple dots appears during the formation of a base, and these bars also display a 10D or 5D pocket pivot volume, it signals institutional buying activity, which could be a strong bullish indicator.

c) If a red dot appears alongside pocket pivot volume, and the day's close is near the low, it’s advisable to wait for the stock to break above the bar's high before making a buy decision. This pattern indicates significant selling pressure, and waiting for the high to be surpassed helps avoid overhead supply.
Release Notes
Added an option to toggle the Pocket Pivot Volume indicators on or off. When zooming out on the weekly chart to view a longer time frame, an excessive number of Pocket Pivot Volume indicators can clutter the display. This new feature allows users to quickly enable or disable these indicators, reducing visual noise for a clearer view.
Release Notes
A pocket pivot volume is represented by a circle at the base of the price bar. The recent update adjusts the circle size to auto-scale, meaning when the chart is zoomed out, the circle becomes smaller and eventually disappears. This prevents clutter, ensuring that the chart remains clear and easy to read at all zoom levels.
contractiongapupInside BarmovingavaragepocketpivotrelativestrengthSupply ZoneswingtradingTrend AnalysisVCP

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer