TradingView
Trendoscope
Oct 15, 2021 12:55 PM

Divergence-Support/Resistence 

Alibaba Group Holding LimitedNYSE

Description

Another script based on zigzag, divergence, and to yield support and resistence levels.

This idea started with below two concepts:

▶ Support and resistence are simply levels where price has rejected to go further down or up. Usually, we can derive this based on pivots. But, if we start looking at every pivot, there will be many of them and may be confusing to understand which one to consider.

▶ Lot of people asked about one of my previous script on divergence detector on how to use it. I believe divergence should be considered as area of support and resistence because, they only amount to temporary weakness in momentum and nothing more. As per my understanding

Trend > Hidden Divergence > Divergence > Oscillator Levels of Overbought and Oversold


⬜ Process

▶ Now combining the above two concepts - what we are trying to do here is draw support resistence lines only on pivots which has observed either divergence or hidden divergence. Continuation and indecision pivots are ignored.
▶ Input requires only few parameters.


Zigzag lengths and oscillator to be used. Oscillator periods are automatically calculated based on zigzag length. Hence no other information required. You can also chose custom oscillator via external source.

▶ Display include horizontal lines of support/resistence which are drawn from the candle from where divergence or hidden divergence is detected.
▶ Support resistence lines are colored based on divergence. Green shades for bullish divergence and bullish hidden divergence whereas red shades for bearish divervence and bearish hidden divergence. Please note, red and green lines does not mean they only provide resistence or support. Any lines which are below the price should be treated as support and any line which are above the price should be treated as resistence.
▶ Divergence symbols are also printed on the bar from where divergence/hidden divergence is detected.
  • ↗ - Bullish Hidden Divergence
  • ↘ - Bearish Hidden Divergence
  • ⤴ - Bullish Divergence
  • ⤵ - Bearish Divergence


▶ Script also demonstrates usage of libraries effectively. I have used following libraries in this code.

import HeWhoMustNotBeNamed/ zigzag /2 as  zg  import HeWhoMustNotBeNamed/enhanced_ta/8 as eta import HeWhoMustNotBeNamed/ supertrend /4 as st


Can be good combination to use it with harmonic patterns.

Release Notes

Major updates

  • zigzag library version updated to 3 which in turn has performance updates
  • Added Max Depth parameter to give user control over how much deep we need to search in order to get support resistence levels. Default is 10.
  • Updated line.new to use time instead of bar to avoid error.

Release Notes

Minor update. Add max_bars_back.
Comments
PineCoders
FinTechKing
Wow sir another bomb in the armory. Thanks a lot for your out of the world thinking.

One doubt sir support and resistance coming as dashed and continuous line in hidden and normal divergence. Am I reading correct if so than pls adjust dashed line for hidden and continuous for normal divergence.or vice-versa as suitable. will be easy to identify
Trendoscope
@FinTechKing, thanks mate :)
Trendoscope
@FinTechKing, Ah.. no.. Dashed is for lower zigzag(8) and solid line is for higher zigzag(13)
FinTechKing
thanks sir understood
tuckerleiske94
How might one add alerts to Divergence symbols?
sabertoothtiger
Nice work! Would it be difficult to setup alerts when price touches any support or resistance line. I'm not familiar with arrays so not sure if it's complex to do alerts here. Also would be nice if the alerts only fire on first touch with the goal being to trade first touch of support/resistance which usually gets a bounce.
tuckerleiske94
How does one add alerts to the divergence labels?
Thinkologist
this is a super code. you are a genius !
thuanckspkt
Tks you verry much
More