OPEN-SOURCE SCRIPT

Divergences (Pivots)

已更新
I created the divergence indicator using pivot points.

Leftbars and Rightbars of Pivots are the same here and taken together as "Div Period", default set as 2 (= "Short" period).
The second period ("Long") multiplies this by 2, if a period of 2 is set, the "Long" period will be 4.
The third period ("Long2") multiplies the "Long" by 2, in this case the "Long2" period would be 8.

In these periods the high and lows of "source" (default = "close", can be changed though) and "RSI" are captured and compared.
The default "RSI length" of "14" can be changed as well.

"Short", "Long" and "Long2" periods can be made visible together or separately (Settings > Inputs).

I recommend to use a "Period" of "1" when using "W" charts, "1 or 2" on "D" charts, and "2 or 3" (maybe higher) when using lower timeframes.

Bullish divergences are "Green", Bearish divergences are "Red", Hidden divergences (Bullish and Bearish) are "White".

"Short" > "▲▼" (Bullish = Up, Bearish = Down)
"Long" > "∆∇" (Bullish = Up, Bearish = Down)
"Long2" > "⇧⇩" (Bullish = Up, Bearish = Down)

The "Values" of "HH"(Higher High), "LL" (Lower Low"), "HL"(Higher Low) & "LH"(Lower High) can be made visible (Settings > Inputs).
快照

Thank you!


快照
版本注释
This is an updated 'divergence indicator using pivot points'
(initially this version was called "'Divergences ( Pivots ) 2")

Instead of needing to change the 'periods' while changing the timeframe, here there are 4 'Periods' where the "high" and "lows" of
the "source" (default = "close", can be changed though) and "RSI" are captured and compared.

快照

Each of the 4 'Periods' ('Very Short' - 'VS', 'Short' - 'S', 'Long' - 'L', 'Very Long' - 'VL') can be separately enabled/disabled/changed.

I like the settings:

"RSI"(20), "Periods": '2' - '4' - '8' - '16'

but it can be different of course, like:

"RSI"(9), "Periods": '1' - '2' - '3' - '4' (this setting was not possible with my first 'Divergences ( Pivots )' indicator)

or other settings for your liking!

The "Values" of "HH"(Higher High), "LL" (Lower Low"), "HL"(Higher Low) & "LH"(Lower High) can be made visible (Settings > Inputs).

快照

Bullish divergences are "Green"
- 'Very Short' - 'VS', 'Short' - 'S' "period" > "▲"
- 'Long' - 'L', 'Very Long' - 'VL' "period" > "⇧"

Bearish divergences are "Red"
- 'Very Short' - 'VS', 'Short' - 'S' "period" > "▼"
- 'Long' - 'L', 'Very Long' - 'VL' "period" > "⇩"

Hidden divergences ( Bullish and Bearish ) are:
- 'Very Short' - 'VS', 'Short' - 'S' "period" > "▲▼" - "White"
- 'Long' - 'L', 'Very Long' - 'VL' "period" > "⬆︎⬇︎" - "Yellow"
版本注释
Hi, made some changes for the better :-)

- RSI is now default 14

More setting options for Divergences:
- 'Long Period', default checks 25 bars to the Left (="History") and 1 bar to the Right (="Future")
- 'Medium Period', default checks 15 bars to the Left (="History") and 1 bar to the Right (="Future")
- 'Short Period', default checks 5 bars to the Left (="History") and 1 bar to the Right (="Future")

Each Bar checks an amount of Bars at the Left (="History") and Bars to the Right (="Future"), insuring this particular Bar is the Highest or Lowest of them all at "close",
this is compared to the or or and so we have our Divergences.
There is always a slight delay (number of Bar(s) at the Right side (="Future")

> You can now alter both sides in a way that suits you best

If you like a setting, where the amount of “RightBars” equals the ”LeftBars” you can enable the " > Only change 'LeftBars'" button.
Then you only have to adjust the amount of “LeftBars” and the amount of “RightBars” automatically will be the same.

- Sensitivity Divergences, default x = '5'
x ⩾ 2 compares the value with ⩾ 2 previous values instead of 1, making the sensitivity higher

Bullish divergences are "Green":
- "⇡︎" = 'Short' "period"
- "↑︎" = 'Medium' "period"
- "⇧" = 'Long' "period"

Bearish divergences are "Red"
- "⇣︎" = 'Short' "period"
- "↓︎" = 'Medium' "period"
- "⇩︎" = 'Long' "period"

Hidden Bullish divergences are "White":
- "⇡︎" = 'Short' "period"
- "↑︎" = 'Medium' "period"
- "⇧" = 'Long' "period"

Hidden Bearish divergences are "White"
- "⇣︎" = 'Short' "period"
- "↓︎" = 'Medium' "period"
- "⇩︎" = 'Long' "period"

While evaluating be sure to check other time frames as well!

Thank you very much!
版本注释
Updated Alerts, also included a General Bull and Bear Alert
版本注释
Added extra alerts
Pivot PointsRelative Strength Index (RSI)

开源脚本

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

想在图表上使用此脚本?


PineCoder: pinecoders.com

- We cannot control our emotions,
but we can control our keyboard -

免责声明