OPEN-SOURCE SCRIPT

Trend/Retracement - ZigZag - New way

ZigZag for Trend and Retracements - New way

It's another way to plot ZigZag based on lookback period for trend and % of trend lookback period to plot retracements.

OVERVIEW
Plot ZigZag, Trend lines, Retracements, Support levels, Resistance levels

Objective:
Draw ZigZag lines along with unbroken support and resistance levels. ZigZag lines are drawn for main trend and the retracements.
Main Trend – This is calculated based on lookback period.
Retracements – Retracements are calculated as 25% of main trend.
Support and Resistance line: The indicator draws 2 types of support and resistance lines
1. Un-broken – Once formed (plotted), these are the support and resistance which are not yet broken
2. Tested – One can also choose to see support and resistance lines which are tested but not broken. Tested support/resistance are those levels which are touched by high/low price but close price has not crossed the level.

How main trend point is calculated:
E.g.
Chart timeframe = 15m
Lookback period = 250
Retracement = 25% of main trend ( 25% of 250 = 62 )
A price point on a chart is considered as trend point if distance between current price and previous highest price is 250 candles
A price point is considered as a retracement if distance between current price and previous highest price is 62 candles. Please note retracements are calculated only after finding a main trend point.

Input parameters:

Zigzag Parameters
  • Use predefined Lookback – If checked pre-defined timeframe-based lookback parameters are used.
  • Trend lookback candles – If ‘Use predefined Lookback’ is unchecked then this value is used as lookback period.
  • Retracement % of look back candles– If ‘Use predefined Lookback’ is unchecked then this value is used for calculating retracement lookback period
  • Mark retracements – If unchecked only main trend lines are plotted
  • Plot support/resistance – To plot support/resistance levels
  • Show support/resistance tested lines – If checked tested support/resistance liens are shown on the chart


TF based Lookback period config (Defaults are set as specified below, One can change these defaults to use different lookback periods)
The defaults set here are used based on the chart timeframe. e.g. if chart timeframe is changed from say 15m to 60m then 60m chart defaults (i.e. trend lookback = 90) are used to plot the trend and the retracements. At the bottom-right of the chart, parameters used for plotting are displayed all the time.
  • Timeframe in minute – Default = 5m
  • Trend lookback candles – Default = 375 (~ 5 days of data)

  • Timeframe in minute – Default = 15m
  • Trend lookback candles – Default = 250 (~10 days of data)

  • Timeframe in minute – Default = 60m
  • Trend lookback candles = Default = 90 (~ 15 days of data)

  • Trend lookback candles for timeframe 'D' – Default = 30 (~1 month data)
  • Trend lookback candles for timeframe 'W' – Default = 21 (~6 months data)
  • Trend lookback candles for timeframe 'M' – Default = 12 (~1year data)
  • Retracement % of look back candles – Default = 25%
    [/lsit]

    When and where one can use this indicator (Refer to chart examples)
    • To view support and resistance based on lookback period
    • To view ZigZag lines
    • One can use it to find chart patterns easily
    • Trend and retracement lines can help in drawing Elliott waves.


    █ Chart examples:
    1. Chart patterns can be easily identified - One can disable the candle charts which will help to identify and draw chart patterns easily
    快照

    2. Trend and retracement lines can also help is analyzing charts (e.g. Elliott Waves can be marked based on trend lines)
    快照

    3. Tested but not broken support and resistance lines can be viewed
    快照

    4. You can select 'NOT' to plot tested support and resistance lines
    快照

    5. Uncheck the Mark retracements to plot main trend lines (Retracements are not marked)
    快照
Chart patternsSupport and ResistanceTrend AnalysisWave AnalysisZigzag

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?

免責聲明