Sharad_Gaikwad

MTF - Zigzag + Tech Indicators

Sharad_Gaikwad 已更新   
MTF - Zigzag + Tech Indicators

At high level the indicator can be a useful tool while analyzing the charts. It marks swing points (Zigzag) on 3 different timeframes along with capability to view key technical indicator values at each of the swing point.

Normally Zaizag indicators are useful for identifying primary trend and retracements. Zigzags also help in identifying key support and resistance areas. Traders develop various trading strategies based on Zigzags.

Most of the published Zigzag indicators use single timeframe / chart timeframe to draw the Zigzag lines but, many traders/chart analysts would like to analyze trends on multiple timeframes. Single timeframe Zigzags makes such analysis little difficult.

This indicator is an advanced version of Zigzag which allow users to draw Zigzag lines on multiple timeframes. It allows users to input 2 additional higher timeframes and in total it draws Zigzag on 3 timeframes i.e., on chart timeframe and 2 additional higher timeframes.

Once loaded on the chart, it draws Zigzag lines and plot labels (HH, LL, HL, LH) which denotes swing points. Each of the swing point label has a tooltip attached to it, which provide few additional data point, to view the additional data points, hover the mouse over the label.

Swing label tooltip shows these additional data points:

  • Tag: Swing type (HH, LL, HL, LH) + Bar time (in dd-mm-yyyy hh:mm format)
  • Price point: Swing price point
  • Price change: Price change since previous swing point along with change %
  • Swing volume: Volume since previous swing point in million
  • Key technical indicator values:
  • RSI (close, 14)
  • Stochastic (close, high, low, 14)
  • ADX (14, 14)
  • SMA20
  • SMA50
  • SMA100
  • SMA200

Use cases:
  • Support resistance: Though most of the swing points of a zigzag are treated as a support or resistance. This indicator allows to add more depth to the analysis. E.g., swing points based on lowest timeframe (chart timeframe) can be treated as weak support/resistance whereas swing points based on higher timeframe can treated as strong support/resistance and prices need to hit it multiple time to cross/break the same.
  • Trend identification: Trend on lowest timeframe (chart timeframe) can be a immediate term trend, trend on the mid-level higher timeframe can be a short term trend and trend on the highest level timeframe can be a long term trend.
  • Trade identification, entry, and exit: MTF Zigzag can also be creatively used while trading. Eg. One can identify a trend on highest level timeframe and use mid-level timeframe for trade entry and lowest level timeframe can be used for Take Profit levels (TP1, TP2, ..) and Stop loss. Alternatively, Trend can be identified on highest or mid-level timeframe and trade entry/exit can be based on lowest level timeframe.
  • Use of information displayed in tooltip: Analysts/traders look for confirmations from other indicators while initiating trades. These additional indicator values become handy/readily available source of information without specifically navigating through different indicators/charts. These indicator values can be creatively used in many ways. Some of the examples are:
  1. Easy comparison of values of moving averages on all 3 timeframes
  2. Better assessment of momentum and overbought/oversold based on value of stochastic and rsi
  3. Use of ADX to determine the strength of the trend
  4. Trade decision based on increasing or decreasing order of moving averages
  5. Trade decision, based order of moving averages combined with overbought/oversold and strength of the trend


Chart examples: TCS on 60m/4h/1D


ITC 4h/1D


Input Parameters:
1. Chart timeframe zigzag setup: to plot zigzag based on chart timeframe
2. Higher timeframe zigzag setup: to plot zigzag based on higher timeframe
3. Higher timeframe zigzag setup 1: to plot zigzag based on another higher timeframe

Each of these have user selectable options:
1. Color/width of the zigzag line
2. plot zigzag line - select/unselect
3. plot HHLL labels - select/unselect

Both (2 and 3) Higher timeframe setups allow to select higher timeframe and offset. Offset can be 0 or 1. This setting normally used to avoid repainting. Select offset as 1 to avoid repainting.

For Pine script developers:
Script elements:
1. Input parameters
2. Type definition (UDT) for ohlc and ph, pl data elements
3. Map definition for visual properties
4. Type instances for chart_tf, higher_tf1, higher_tf2
5. Important variable – for indicator values
6. Methods –
a. get_ph_pl() – get ph, pl data for each of the tf along with indicator values
b. add_ph(), add_pl() – add ph, pl data to timeframe specific udt, plot the zigzag and labels, add tooltip to label

Script structure
1. Input parameters
2. Variable and type definitions
3. Methods and functions
4. For each of timeframe, call functions and methods
a. Check ph, pl (if swing point formed)
b. Plot ph, pl (if applicable) i.e. zigzag line, labels
版本注释:
Revising the publication with:
1. Changes to left and right bar default parameters
2. Changes to default HTF timeframes
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?