OPEN-SOURCE SCRIPT
IPDA Time (3, 6, 9) [Final v3]

This Pine Script code defines a custom TradingView indicator called "IPDA Time (3, 6, 9)". It is designed to identify specific bars on the chart where the digital root of the current time (hour and minute) equals 3, 6, or 9, which are numbers often associated with cycles and market timing concepts in trading.
1. What the Code Does
The script calculates two main time values based on a concept known as the Digital Root (also called the "Digital Sum").
The Digital Root Function
The core logic uses a custom function, getDigitalRoot(number), which calculates the digital root of any number. The digital root is the single digit obtained by an iterative process of summing the digits of a number, repeatedly until a single digit is reached (e.g., the digital root of 48 is 4+8=12→1+2=3).
Signal Calculations
The script extracts the individual digits from the current chart's hour and minute (h, m) and performs two distinct digital root calculations:
hourPlusMinuteValue (High Confluence Check): Calculates the digital root of the sum of all four digits (two from the hour, two from the minute).
minuteOnlyValue (Minute Check): Calculates the digital root of the sum of the two minute digits only.
Logic and Signal Generation
The code generates three types of signals based on whether these digital roots equal 3, 6, or 9:
High-Importance (Green Square): Generated when BOTH the "Hour + Minute" check (isHourPlusMinuteSignal) and the "Minute Only" check (isMinuteOnlySignal) are true.
Hour + Minute Only (Blue Diamond): Generated when ONLY the "Hour + Minute" check is true.
Minute Only (Yellow Diamond): Generated when ONLY the "Minute Only" check is true.
2. Visual Output on the Chart
The indicator visualizes these signals directly on the price chart:
Signal Type Shape (Style) Color Location Additional Effect
High-Importance Square (shape.square) Green Above Bar Changes the bar's color to green (with 75% transparency).
Hour + Minute Only Diamond (shape.diamond) Blue Above Bar N/A
Minute Only Diamond (shape.diamond) Yellow Above Bar N/A
Export to Sheets
The visual markers appear above the bar/candle that corresponds to the specific time criteria being met, highlighting moments the indicator's logic deems significant.
Tools
1. What the Code Does
The script calculates two main time values based on a concept known as the Digital Root (also called the "Digital Sum").
The Digital Root Function
The core logic uses a custom function, getDigitalRoot(number), which calculates the digital root of any number. The digital root is the single digit obtained by an iterative process of summing the digits of a number, repeatedly until a single digit is reached (e.g., the digital root of 48 is 4+8=12→1+2=3).
Signal Calculations
The script extracts the individual digits from the current chart's hour and minute (h, m) and performs two distinct digital root calculations:
hourPlusMinuteValue (High Confluence Check): Calculates the digital root of the sum of all four digits (two from the hour, two from the minute).
minuteOnlyValue (Minute Check): Calculates the digital root of the sum of the two minute digits only.
Logic and Signal Generation
The code generates three types of signals based on whether these digital roots equal 3, 6, or 9:
High-Importance (Green Square): Generated when BOTH the "Hour + Minute" check (isHourPlusMinuteSignal) and the "Minute Only" check (isMinuteOnlySignal) are true.
Hour + Minute Only (Blue Diamond): Generated when ONLY the "Hour + Minute" check is true.
Minute Only (Yellow Diamond): Generated when ONLY the "Minute Only" check is true.
2. Visual Output on the Chart
The indicator visualizes these signals directly on the price chart:
Signal Type Shape (Style) Color Location Additional Effect
High-Importance Square (shape.square) Green Above Bar Changes the bar's color to green (with 75% transparency).
Hour + Minute Only Diamond (shape.diamond) Blue Above Bar N/A
Minute Only Diamond (shape.diamond) Yellow Above Bar N/A
Export to Sheets
The visual markers appear above the bar/candle that corresponds to the specific time criteria being met, highlighting moments the indicator's logic deems significant.
Tools
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。