LuxAlgo

Delta ZigZag [LuxAlgo]

The Delta ZigZag indicator is focused on volume analysis during the development of ZigZag lines. Volume data can be retrieved from a Lower timeframe (LTF) or real-time Tick data.

Our Delta ZigZag publication can be helpful in detecting indications of a trend reversal or potential weakening/strengthening of the trend.

This indicator by its very nature backpaints, meaning that the displayed components are offset in the past.

🔶 USAGE


The ZigZag line is formed by connecting Swings, which can be set by adjusting the Left and Right settings.

  • Left is the number of bars for evaluation at the left of the evaluated point.
  • Right is the number of bars for evaluation at the right of the evaluated point.

A valid Swing is a value higher or lower than the bars at the left/right.

A higher Left or Right set number will generally create broader ZigZag (ZZ) lines, while the drawing of the ZZ line will be delayed (especially when Right is set higher). On the other hand, when Right is set at 0, ZZ line are drawn quickly. However, this results in a hyperactive switching of the ZZ direction.

To ensure maximum visibility of values, we recommend using "Bars" from the "Bar's style" menu.

🔹 Volume examination

The script provides two options for Volume examination:

  1. Examination per ZigZag line
  2. Examination per bar

Bullish Volume is volume associated with a green bar (close > open)
Bearish Volume is volume associated with a red bar (close < open)
Neutral Volume (volume on a "close == open" bar) is not included in this publication.

🔹 Examination per ZigZag line

As long as the price moves in the same direction, the present ZZ line will continue. When the direction of the price changes, the bull/bear volume of the previous ZZ line is evaluated and drawn on the chart.

  • The ZZ line is divided into two parts: a bullish green line and a bearish red line.
  • The intercept of these two lines will depend on the ratio of bullish/bearish volume
  • This ratio is displayed at the intercept as % bullish volume (Settings -> Show % Bullish Volume)

* Note that we cannot draw between 2 bars. Therefore, if a ZZ line is only 1 bar long, the intercept will be at one of those 2 bars and not in between. The percentage can be helpful in interpreting bull/bear volume.


In the example above (2 most right labels), you can see that an overlap of 2 labels is prevented, ensuring the ability to evaluate the bullish % volume of the ZZ line.

The percentage will be colored green when more than 50%, red otherwise. The color will fade when the direction is contradictory; for example, 40% when the ZZ line goes up or 70% when the ZZ line falls.

More details can be visualized by enabling "Show" and choosing 1 of 3 options:

  • Average Volume Delta/bar
  • Average Volume/bar
  • Normalised Volume Delta

For both 'averages', the sum of "Volume"/"Volume Delta" of every bar on the ZZ line is divided by the number of bars (per ZZ line).

The "Normalised Volume Delta" is calculated by dividing the sum of "Delta Volume" by the sum of "Volume" (neutral volume not included), which is displayed as a percentage.

All three options will display a label at the last point of the ZZ line and be coloured similarly: green when the ratio bullish/bearish volume of the ZZ line is bullish and red otherwise. Here, the colour also fades when it is bullish, but the ZZ line falls or when it is bearish with a rising ZZ line.

A tooltip at each label hints at the chosen option.


You can pick one of the options or combine them together.



🔹 Examination per bar

Besides information about what's happening during the ZZ line, information per bar can be visualized by enabling "Show Details" in Settings.


  • Split Volume per bar: show the sum of bullish (upV) and bearish (dnV) volume per bar
  • Volume (bar): Total Volume per bar (bullish + bearish volume, neutral volume not included)
  • Δ Volume (bar): Show Delta Volume (bullish - bearish volume)

🔹 Using Lower Timeframe Data


The ZigZag lines using LTF data are colored brighter. Also note the vertical line where the LTF data starts and the gap between ZZ lines with LTF data and without.

When "LTF" is chosen for the "Data from:" option in Settings, data is retrieved from Lower Timeframe bars (default 1 minute). When the LTF setting is higher than the current chart timeframe, the LTF period will automatically be adjusted to the current timeframe to prevent errors.


As there is a 100K limit to the number of LTF intrabars that can be analyzed by a script, this implies the higher the difference between LTF and current TF; the fewer ZZ lines will be seen.

🔹 Using real-time tick data


The principles are mostly the same as those of LTF data. However, in contrast with LTF data, where you already have LTF ZZ lines when loading the script, real-time tick data-based ZZ lines will only start after loading the chart.


Changing the settings of a ticker will reset everything. However, returning to the same settings/ticker would show the cached data again.


Here, you can see that changing settings reset everything, but returning after 2 minutes to the initial settings shows the cached data. Don't expect it to be cached for hours or days, though.

🔶 DETAILS

The timeframe used for LTF data should always be the same or lower than the current TF; otherwise, an error occurs. This snippet prevents the error and adjusts the LTF to the current TF when LTF is too high:

res  = input.timeframe('1')
res := timeframe.from_seconds(  math.min( timeframe.in_seconds(timeframe.period), timeframe.in_seconds(res) )  )

🔶 SETTINGS

  • Data from: LTF (Lower TimeFrame) or Ticks (Real-time ticks)
  • Res: Lower TimeFrame (only applicable when choosing LTF)
  • Option: choose "high/low" or "close" for Swing detection

🔹 ZigZag

  • Left: Lookback period for Swings
  • Right: Confirmation period after potential Swing

🔹 ZigZag Delta

  1. Show % Bullish Volume: % bullish volume against total volume during the ZZ line
  2. Show:

  • Average Volume Delta/bar
  • Average Volume/bar
  • Normalised Volume Delta

See USAGE for more information

🔹 Bar Data

  • Split Volume per bar: shows the sum of bullish (upV) and bearish (dnV) volume per bar
  • Volume (bar): Total Volume per bar (bullish + bearish volume, neutral volume not included)
  • Δ Volume (bar): Show Volume Delta (bullish - bearish volume)

Get access to our exclusive tools: luxalgo.com

Join our 150k+ community: discord.gg/lux

All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

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

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?