OPEN-SOURCE SCRIPT

Intermarket Swing Projection [LuxAlgo]

6 308
The Intermarket Swing Projection allows traders to plot price movement swings from any user-selected asset directly onto the chart in the form of zigzags and/or horizontal support and resistance levels.

This tool rescale the external asset price on the user chart, enabling traders to make direct comparisons.

It answers the question of how different the price behavior is between two assets, accounting for each asset's volatility.

🔶 USAGE

ảnh chụp nhanh

This tool is based on swing detection of two different assets: the chart and a user-selected asset. It allows traders to compare two assets on an equal footing while accounting for volatility and price behavior.

Traders can customize the detection by selecting a custom ticker, timeframe, the number of swings and length for swing detection. This makes the tool a Swiss army knife for asset comparison.

ảnh chụp nhanh

As we can see in the image below, the Show Last, Pivot Length, and Spread parameters are key to defining the final output of the tool.

"Show Last" defines how many pivots are displayed. "Pivot Length" is used for pivot detection; a larger value will detect larger market structures. "Spread" defines how far apart the horizontal levels will be from their original location in terms of volatility.

🔹 Comparing different assets

ảnh chụp nhanh

This image shows the Nasdaq 100 futures contract compared to four other futures contracts: S&P 500, gold, bitcoin, and euro/U.S. dollar.

Plotting all of these assets in Nasdaq 100 terms makes it easy to compare and analyze price behaviors and identify key levels.
  • In the top left chart, we have NQ vs. ES. It's no surprise that they are practically an exact match; a large portion of the S&P 500 is technology.
  • In the top right chart, NQ vs. GC, we see totally different behaviors. We can clearly see the summer consolidation in gold and the resumption of the uptrend, which took gold above 29,200 NQ points, up from 21,200.
  • In the bottom right chart, we see bitcoin making new highs, way above the Nasdaq in May, July, and October. However, the last high was way below the Nasdaq prices on October 27—the first lower high in a while. Sellers are pushing down.
  • Finally, the bottom left chart is NQ vs. 6E. We can see large volatility in the uptrend since February, with NQ unable to catch up until now. The last swing low was almost a match, and 6E is in a range.

As we can see, this tool allows us to perform intermarket analysis properly by accounting for each asset's volatility and price behavior. Then, we plot them on the same scale on equal terms, which makes performing this kind of analysis easy.

ảnh chụp nhanh

As we can see in the chart above, the assets are the same as in the previous image, but the timeframe is 1H with different settings.

Note the horizontal levels acting as support and resistance, as well as how NQ prices react to the zones marked with white circles. These levels are derived from custom assets selected by the user.

🔹 Displaying Elements

ảnh chụp nhanh

Zig-zag allows traders to clearly see the path that the selected asset's price took, as well as its turning points.

Horizontal levels are displayed from those turning points to the present and can be used as support or resistance. Traders can adjust the spread parameter in the settings panel to expand or contract those levels' volatility.

There are two color modes for the levels: average and pivots. In the first mode, green is used for levels below the average and red for levels above the average. The second uses green for swing lows and red for swing highs.

The backpaint feature is enabled by default and allows the swings to be displayed in the correct location. With this feature disabled, the swings will be displayed in the current location when a new swing is detected.

🔶 DETAILS

On a more technical note, the rescaling is formed by calculating three main elements from all the swings detected on the custom and chart assets:
  • The chart asset's average of all swing points
  • The chart asset's standard deviation of all swing points
  • The custom asset's z-score for each swing point

Then, the re-scaled swing point is calculated as the average plus the z-score multiplied by the standard deviation. This makes it possible to plot AAPL swings on an NQ chart, for example.

Thanks to re-scaling, we can directly compare the price behavior of two assets with different price ranges and volatility on the same chart.

🔶 SETTINGS

🔹 Trendlines

  • Ticker: Select the custom ticker.
  • Timeframe: Select a custom timeframe.
  • Show Last: Select how many swing points to display.
  • Pivot Length: Select the size for swing point detection.
  • Spread: Volatility multiplier for horizontal levels. Larger values mean the levels are farther apart.
  • Backpaint: Enable or disable the backpaint feature. When enabled, the drawings will be displayed where they were detected. When disabled, the drawings will be displayed at the moment of detection.


🔹 Style

  • Show ZigZag: Enable or disable the ZigZag display and choose a line style.
  • Show Levels: Enable or disable the levels display and choose a line style.
  • Color Mode: Choose between Average Mode, which colors all levels below the average bullish and all levels above bearish, and Pivot Mode, which colors swing highs bearish and swing lows bullish.
  • Bullish: Select a bullish color.
  • Bearish: Select a bearish color.
  • ZigZag: Select the ZigZag color.

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.