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 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항