OPEN-SOURCE SCRIPT
已更新 Multiple Divergences (UDTs - objects) - Educational

█ OVERVIEW
This script highlights the usage of User-defined Types (UDTs) and objects, and bullish /bearish divergences.
Pivotpoints are used to find divergences, the result of this script will be different against other public multiple divergences scripts.
FOR Pine Script™ CODERS
Besides the information found in CONCEPTS, the comments in the script will, hopefully ), guide you through my thought process.
█ CONCEPTS
The main principle of this script are bullish /bearish divergences, this with 3 different oscillators (RSI, CCI, MFI)
If you want to know more about divergences, have a look at some Education and Research idea's.
█ REMARKS
A label will be visible with a number, this is the amount of divergences found with the according oscillator.
EXAMPLE
Divergences should only be used when confirmed, this is after bar close.
As an aid, lines that are not confirmed will be dotted, if confirmed, they will be solid.
The divergence check start when a ph/pl is found, after which oscillator pivot are checked.
Optionally the same can be done, when a oscillator pivot is found and then check the ph/pl,
this should give more results, although it can make the script slower.
█ SETTINGS
Have FUN!
This script highlights the usage of User-defined Types (UDTs) and objects, and bullish /bearish divergences.
Pivotpoints are used to find divergences, the result of this script will be different against other public multiple divergences scripts.
FOR Pine Script™ CODERS
Besides the information found in CONCEPTS, the comments in the script will, hopefully ), guide you through my thought process.
█ CONCEPTS
The main principle of this script are bullish /bearish divergences, this with 3 different oscillators (RSI, CCI, MFI)
If you want to know more about divergences, have a look at some Education and Research idea's.
- On every bar, an object HLs is made, containing bar_index, high, low, and 2 bool variables (isPh, isPl).
- On every bar, an object Osc is made, containing bar_index, o (oscillator value), and 2 bool variables (isPh, isPl).
- If a pivothigh (ph ) is found, isPh will be true on that bar, false otherwise.
- If a pivotlow (pl) is found, isPl will be true on that bar, false otherwise.
- These objects are added to an array, with limited size.
- If a ph is found, the script draws a testline from that ph to every previous ph, found in the array.
- Then every high in between these 2 points are checked if they don't pierce the testline.
- If the testline isn't broken, the Reg_Div_Piv() function will give 4 values, 1 check (not pierced) variable and the 4 points of the line.
- The testline is deleted.
- Once a positive check is found, the script will perform the same, but now with the Osc objects.
- The script will ONLY compare Oscpivots which are maximum 1 bar away from the high/low pivot.
- If everything is confirmed, a line is drawn, visible on the chart.
█ REMARKS
A label will be visible with a number, this is the amount of divergences found with the according oscillator.
EXAMPLE
- Div with RSI and CCI -> 2
- Div with MFI alone -> 1
- Div with RSI and CCI and MFI -> 3
...
Divergences should only be used when confirmed, this is after bar close.
As an aid, lines that are not confirmed will be dotted, if confirmed, they will be solid.
The divergence check start when a ph/pl is found, after which oscillator pivot are checked.
Optionally the same can be done, when a oscillator pivot is found and then check the ph/pl,
this should give more results, although it can make the script slower.
█ SETTINGS
- Left - amount of bars at the left which needs to be lower/higher
- Right - amount of bars at the right which needs to be lower/higher
- Max values - maximum values in array of objects
- 3 oscillator settings with
• ON/OFF
• Length
• color bullish divergence
• color bearish divergence
Have FUN!
版本注释
Completed arguments in functions -> This gives more information while hovering over function names.开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
Who are PineCoders?
tradingview.com/chart/SSP/yW5eOqtm-Who-are-PineCoders/
TG Pine Script® Q&A: t.me/PineCodersQA
- We cannot control our emotions,
but we can control our keyboard -
tradingview.com/chart/SSP/yW5eOqtm-Who-are-PineCoders/
TG Pine Script® Q&A: t.me/PineCodersQA
- We cannot control our emotions,
but we can control our keyboard -
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
Who are PineCoders?
tradingview.com/chart/SSP/yW5eOqtm-Who-are-PineCoders/
TG Pine Script® Q&A: t.me/PineCodersQA
- We cannot control our emotions,
but we can control our keyboard -
tradingview.com/chart/SSP/yW5eOqtm-Who-are-PineCoders/
TG Pine Script® Q&A: t.me/PineCodersQA
- We cannot control our emotions,
but we can control our keyboard -
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。