Digital Root Equals Time and Price

abundant1

New member
Hello. I wanted to know if anyone could write a code that marks when time and price digital roots are equal. Not sure if it is possible or if it is of any value. Thank you.

mod note:
The Digital Root is calculated by summing the digits of the current time and then current price.
OP is inquiring how to detect when the digital roots for time and price are equal
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

i made a excel file to verify the math, based on wiki page
will try to make a study from it

in excel
go to a blank sheet
CNTRL-TILDE (formula mode)
paste in this code
CNTRL-TILDE (go back to normal mode)

Code:
    digital root                                                            
                                                                
num                                                                digital root
12345    =C4+1    0    =MOD($A$4,$A$7^B4)    =MOD($A$4,$A$7^C4)    =$A$7^C4    =(D4-E4)/F4        =G4+G5+G6+G7+G8+G9+G10+G11    =B4    =C4    =MOD($I$4,$A$7^J4)    =MOD($I$4,$A$7^K4)    =$A$7^K4    =(L4-M4)/N4        =O4+O5+O6+O7+O8+O9+O10+O11
    =B4+1    =C4+1    =MOD($A$4,$A$7^B5)    =MOD($A$4,$A$7^C5)    =$A$7^C5    =(D5-E5)/F5            =B5    =C5    =MOD($I$4,$A$7^J5)    =MOD($I$4,$A$7^K5)    =$A$7^K5    =(L5-M5)/N5        
base    =B5+1    =C5+1    =MOD($A$4,$A$7^B6)    =MOD($A$4,$A$7^C6)    =$A$7^C6    =(D6-E6)/F6            =B6    =C6    =MOD($I$4,$A$7^J6)    =MOD($I$4,$A$7^K6)    =$A$7^K6    =(L6-M6)/N6        
10    =B6+1    =C6+1    =MOD($A$4,$A$7^B7)    =MOD($A$4,$A$7^C7)    =$A$7^C7    =(D7-E7)/F7            =B7    =C7    =MOD($I$4,$A$7^J7)    =MOD($I$4,$A$7^K7)    =$A$7^K7    =(L7-M7)/N7        
    =B7+1    =C7+1    =MOD($A$4,$A$7^B8)    =MOD($A$4,$A$7^C8)    =$A$7^C8    =(D8-E8)/F8            =B8    =C8    =MOD($I$4,$A$7^J8)    =MOD($I$4,$A$7^K8)    =$A$7^K8    =(L8-M8)/N8        
    =B8+1    =C8+1    =MOD($A$4,$A$7^B9)    =MOD($A$4,$A$7^C9)    =$A$7^C9    =(D9-E9)/F9            =B9    =C9    =MOD($I$4,$A$7^J9)    =MOD($I$4,$A$7^K9)    =$A$7^K9    =(L9-M9)/N9        
    =B9+1    =C9+1    =MOD($A$4,$A$7^B10)    =MOD($A$4,$A$7^C10)    =$A$7^C10    =(D10-E10)/F10            =B10    =C10    =MOD($I$4,$A$7^J10)    =MOD($I$4,$A$7^K10)    =$A$7^K10    =(L10-M10)/N10        
    =B10+1    =C10+1    =MOD($A$4,$A$7^B11)    =MOD($A$4,$A$7^C11)    =$A$7^C11    =(D11-E11)/F11            =B11    =C11    =MOD($I$4,$A$7^J11)    =MOD($I$4,$A$7^K11)    =$A$7^K11    =(L11-M11)/N11        
                                                                
num    3110                                                            
base    12                                                            
dig1    19                                                            
dig2    8
 

Attachments

  • xls-img1.JPG
    xls-img1.JPG
    60 KB · Views: 37
Hello. I wanted to know if anyone could write a code that marks when time and price digital roots are equal. Not sure if it is possible or if it is of any value. Thank you.

mod note:

i think this works. i was just finishing up and i changed the ticker and realized tos stopped loading ticker data......
fricken maintenence.... just a swirling logo

a lower study

find digital roots of,
. time, ( can choose time data of HHMM or minutes)
. and price (close)
draw 2 lines, for the 2 roots
if the roots match, draw an up arrow

i used the math on wiki site. link at end of code
https://en.wikipedia.org/wiki/Digital_root#:~:text=The digital root (also repeated,to compute a digit sum.

i made a script with the math. i run numbers through script twice, to get a single digit number


Code:
#digital_root

#------------------------
# halcyonguy
# 24-01-10
#------------------------
#https://usethinkscript.com/threads/digital-root-equals-time-and-price.20226/
#Digital Root Equals Time and Price
#abundant1  1/10
# write a code that,
# marks when time and price digital roots are equal.
#------------------------

declare lower;

def na = double.nan;
def bn = barnumber();
def base = 10;
# restrict price data to dollars
def cls_n = Round(close, 0);

#------------------------
# input a number and base, calc digital root
script digroot{
 input n = 0;
 input base = 10;
 def r1 = ((n % power(base,1)) - (n % power(base,0)))/power(base,0);
 def r2 = ((n % power(base,2)) - (n % power(base,1)))/power(base,1);
 def r3 = ((n % power(base,3)) - (n % power(base,2)))/power(base,2);
 def r4 = ((n % power(base,4)) - (n % power(base,3)))/power(base,3);
 def r5 = ((n % power(base,5)) - (n % power(base,4)))/power(base,4);
 def r6 = ((n % power(base,6)) - (n % power(base,5)))/power(base,5);
 def r7 = ((n % power(base,7)) - (n % power(base,6)))/power(base,6);
 def r8 = ((n % power(base,8)) - (n % power(base,7)))/power(base,7);
 def rttl = r1+r2+r3+r4+r5+r6+r7+r8;
 plot z = rttl;
}

#------------------------
# price root

def price_root1 =  digroot(cls_n);
#plot z1 = price_root1;
def price_root2 = if price_root1 < 10 then price_root1 else digroot(price_root1);
plot z2 = price_root2;
z2.SetDefaultColor(Color.yellow);

#------------------------
# time root

# hours_minutes  HHMM
# calc HHMM from elapsed minutes
# adjust for time zone
#https://usethinkscript.com/threads/vertical-line-with-time.15159/#post-124472
#sleepyz
input timezone = {default "ET", "CT", "MT", "PT"};
def hour_offset = (if timezone == timezone."ET" then 0
      else if timezone == timezone."CT" then -1
      else if timezone == timezone."MT" then -2
      else -3);


input time_data = { default hours_minutes , minutes };

def start = 0000;

def tmin1 = SecondsFromTime(start)/60;
def thour1 = tmin1/60;
def thour2 = floor(thour1);
def tmin2 = (thour1 - thour2)*60;
def thour3 = (thour2 + hour_offset);
def thour4 = if thour3 > 0 then thour3 else thour3 + 11;
def time_hhmm = (thour4*100)+tmin2;

#---------------------
# time - HHMM
def time_hhmm_root1 =  digroot(time_hhmm);
def time_hhmm_root2 = if time_hhmm_root1 < 10 then time_hhmm_root1 else digroot(time_hhmm_root1);

#--------------------
# time - minutes
def time_min_root1 = digroot(tmin1);
def time_min_root2 = if time_min_root1 < 10 then time_min_root1 else digroot(time_min_root1);

#--------------------

def time_rootx;
def t;
switch(time_data) {
case hours_minutes:
 time_rootx = time_hhmm_root2;
 t = 1;
case minutes:
 time_rootx = time_min_root2;
 t = 2;
}

#--------------------
plot z3 = time_rootx;
z3.SetDefaultColor(Color.cyan);

#--------------------

def root_match = (price_root2 == time_rootx);

#root_match
plot zm = if root_match then price_root2*0.92 else na;
zm.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
zm.SetDefaultColor(Color.cyan);
zm.setlineweight(3);
zm.hidebubble();


#--------------------
addlabel(1, "price root " + price_root2 + " ", z2.takevaluecolor());
addlabel(1, "time root " + time_rootx + " ", z3.takevaluecolor());
addlabel(1, (if t == 2 then "minutes" else "HHMM"), z3.takevaluecolor());

#--------------------

input test_bubbles1 = no;
addchartbubble(test_bubbles1, 0,
 "price\n" +
 cls_n + "\n" +
 price_root2
, z2.takevaluecolor(), no);

addchartbubble(test_bubbles1 and t == 1, 0,
 "time HHMM\n" +
thour4 + ":" + tmin2 + "\n" +
 time_hhmm + " hm\n" +
 time_hhmm_root1 + " r1\n" +
 time_hhmm_root2 + " r2"
, z3.takevaluecolor(), no);

addchartbubble(test_bubbles1 and t == 2, 0,
 "time minutes\n" +
 tmin1 + " min\n" +
 time_min_root1 + " r1\n" +
 time_min_root2 + " r2\n"
, z3.takevaluecolor(), no);

#------------------------
# ref
#https://en.wikipedia.org/wiki/Digital_root#:~:text=The%20digital%20root%20(also%20repeated,to%20compute%20a%20digit%20sum.
#
 

Attachments

  • img3.JPG
    img3.JPG
    46.4 KB · Views: 23
Thread starter Similar threads Forum Replies Date
A Square root (22.5×EPS×BVPS) Questions 2

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
458 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top