Multi-ZigZag Multi-Oscillator Trend Detector

This table is intended to give you snapshot of how price and oscillators are moving along with zigzag pivots .

This is done in the same lines of Zigzag-Trend-Divergence-Detector
But, here are the differences

  • Table shows multiple oscillator movements at a same time instead of one selected oscillator
  • Divergence is not calculated and also supertrend based trend. Trend can be calculated based on zigzag movements. However, lets keep this for future enhancements.
  • This system also uses multiple zigzags instead of just one.

⬜ Process

▶ Derive multiple zigzags - Code is taken from Multi-ZigZag
▶ Along with zigzags - also calculate different oscillators and attach it to zigzag pivot .
▶ Calculate directions of zigzag pivots and corresponding oscillators.
▶ Plot everything in the table on last bar.

⬜ Table components

Table contains following data: Directional legends are:
  • ⇈ - Higher High (Green)
  • ⇊ - Lower Low (Red)
  • ⭡- Lower High (Orange)
  • ⭣ - Higher Low (Lime)

⬜ Input Parameters

Source : Default is close. If Unchecked - uses high/low data for calculating pivots . Can also use external input such as OBV
Stats : Gives option to select the depth of output (History) and also lets you chose text size and table position.
Oscillators : Oscillator length is derived by multiplying multiplier to zigzag length. For example, for zigzag 5, with 4 as multiplier, all oscillators are calculated with length 20. But, same for zigzag 8 will be 32 and so on.
Available oscillators :
  • CCI - Commodity Channel Index
  • CMO - Chande Momentum Oscillator
  • COG - Center Of Gravity
  • MFI - Money Flow Index (Shows only if volume is present)
  • MOM - Momentum oscillator
  • ROC - Rate Of Change
  • RSI - Relative Strength Index
  • TSI - Total Strength Index
  • WPR - William Percent R
  • BB - Bollinger Percent B
  • KC - Keltner Channel Percent K
  • DC - Donchian Channel Percent D
  • ADC - Adoptive Donchian Channel Percent D (Adoptive-Donchian-Channel)

    ⬜ Challenges

    There are 12 oscillators and each zigzag has different length. Which means, there are 48 combinations of the ocillators.

    First challenge was generating these values without creating lots of static initialization. Also, note, if the functions are not called on each bar, then they will not yield correct result. This is achieved through initializer function which runs on every bar and stores the oscillator values in an array which emulates multi dimensional array oscillator X zigzag length.

    Next challenge was getting these values within function when we need it. While doing so I realized that values stored in array also have historical series and calling array.get will actully get you the entire series and not just the value. This is an important takeaway for me and this can be used for further complex implementations.

    Thanks to @LonesomeTheBlue and @LucF for some timely suggestions and interesting technical discussions :)
릴리즈 노트: Major update
  • Added Zigzag based supertrend for all zigzag levels. Original implementation of zigzag supertrend is here: ZigZag-Supertrend
  • Added divergence sentiment to all the oscillators which is calculated based on the initial indicator. Detailed rule:
  • The script is pretty heavy and it started throwing pine error on number of lines exceeding 60000. To avoid this, had to remove some of the oscillators/indicators. Have removed Momentum which is quite different from most of them. And have removed Keltener channel, Donchian Channel and Advanced Donchian Channel as they produce almost similar results as that of Bollinger Band.

PS: If you need older version you can load the script to codebase and then select different version of it from version history.
릴리즈 노트: Major Updates
  • Redefined color coding to show different colors for divergence and hidden divergence.
  • Bullish and bearish indecision is marked with different symbols (⤒ and ⤓) wheras invalid divergence and hidden divergence preserves the existing indecision symbol - ▣
릴리즈 노트: Convert to pine 5

Please PM me if you need access to any invite only scripts.

Join tradingview: https://www.tradingview.com/gopro/?share_your_love=sudh
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

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