PLOT: Tunnels Through Time

d4dahl

d4dahl

New member
First post! Glad to have found you.

I’ve recently been intrigued with W.D. Gann theory. I’ve been scouring the internet for script similar to my idea, but can’t find anything close to what I want so I tried my hand at coding. Long story short, I’m awful. I also posted this on Reddit, but it's dead there, so hoping for some help.

What I want is simple, that is horizontal lines, aka “tunnels”, at specified price levels. OR, a 10% color overlay between levels, say $0-12, $24-36, $48-60, etc. Each way achieves the same desired outcome, they just look different.

In the end, it might be great to have all 12 sections of the zodiac: Aries, Taurus, Gemini, etc, selectable in the customizing window. But maybe having only one zodiac sign per study is best? Not sure yet.

Each sign has their own tunnels, but below is my script for Aries only. It seems extremely text heavy for something so simple. And, in the customizing window, you have to click each plot ON/OFF as to whether or not you want to see that specific level. It’s quite time consuming, hoping to avoid that. I can give the other zodiac levels in a future post, but they all follow the same formula, just add 12 to the previous one up to 360.

Also, color seems like it should be easier to script than what I have below. And, magnification is an issue when they're all turned on. Hopefully that can be fixed, too.

So, my question to the community is if a mathematical formula could somehow be used for the plot? Please have a look. And, thank you!

#ARIES
#Tunnels Through Time
#0-29° plot for W.D. Gann's Wheel of 12

plot theLine12 = 12;
plot theLine24 = 24;
plot theLine36 = 36;
plot theLine48 = 48;
plot theLine60 = 60;
plot theLine72 = 72;
plot theLine84 = 84;
plot theLine96 = 96;
plot theLine108 = 108;
plot theLine120 = 120;
plot theLine132 = 132;
plot theLine144 = 144;
plot theLine156 = 156;
plot theLine168 = 168;
plot theLine180 = 180;
plot theLine192 = 192;
plot theLine204 = 204;
plot theLine216 = 216;
plot theLine228 = 228;
plot theLine240 = 240;
plot theLine252 = 252;
plot theLine264 = 264;
plot theLine276 = 276;
plot theLine288 = 288;
plot theLine300 = 300;
plot theLine312 = 312;
plot theLine324 = 324;
plot theLine336 = 336;
plot theLine348 = 348;
plot theLine360 = 360;

theLine12.SetDefaultColor(CreateColor(204,0,51));
theLine24.SetDefaultColor(CreateColor(204,0,51));
theLine36.SetDefaultColor(CreateColor(204,0,51));
theLine48.SetDefaultColor(CreateColor(204,0,51));
theLine60.SetDefaultColor(CreateColor(204,0,51));
theLine72.SetDefaultColor(CreateColor(204,0,51));
theLine84.SetDefaultColor(CreateColor(204,0,51));
theLine96.SetDefaultColor(CreateColor(204,0,51));
theLine108.SetDefaultColor(CreateColor(204,0,51));
theLine120.SetDefaultColor(CreateColor(204,0,51));
theLine132.SetDefaultColor(CreateColor(204,0,51));
theLine144.SetDefaultColor(CreateColor(204,0,51));
theLine156.SetDefaultColor(CreateColor(204,0,51));
theLine168.SetDefaultColor(CreateColor(204,0,51));
theLine180.SetDefaultColor(CreateColor(204,0,51));
theLine192.SetDefaultColor(CreateColor(204,0,51));
theLine204.SetDefaultColor(CreateColor(204,0,51));
theLine216.SetDefaultColor(CreateColor(204,0,51));
theLine228.SetDefaultColor(CreateColor(204,0,51));
theLine240.SetDefaultColor(CreateColor(204,0,51));
theLine252.SetDefaultColor(CreateColor(204,0,51));
theLine264.SetDefaultColor(CreateColor(204,0,51));
theLine276.SetDefaultColor(CreateColor(204,0,51));
theLine288.SetDefaultColor(CreateColor(204,0,51));
theLine300.SetDefaultColor(CreateColor(204,0,51));
theLine312.SetDefaultColor(CreateColor(204,0,51));
theLine324.SetDefaultColor(CreateColor(204,0,51));
theLine336.SetDefaultColor(CreateColor(204,0,51));
theLine348.SetDefaultColor(CreateColor(204,0,51));
theLine360.SetDefaultColor(CreateColor(204,0,51));

#endCode
 
T

tomsk

Well-known member
VIP
The lines seem to be at multiples of 12 so perhaps something like the following might work

Code:
def initial = 12;

plot theLine1 = initial*1;
plot theLine2 = initial*2;
plot theLine3 = initial*3;
plot theLine4 = initial*4;
plot theLine5 = initial*5;
 
d4dahl

d4dahl

New member
OK. Fixed the magnification issue:

Chart settings > Price Axis, uncheck Fit studies
 
d4dahl

d4dahl

New member
The lines seem to be at multiples of 12 so perhaps something like the following might work

Code:
def initial = 12;

plot theLine1 = initial*1;
plot theLine2 = initial*2;
plot theLine3 = initial*3;
plot theLine4 = initial*4;
plot theLine5 = initial*5;

Thanks Tomsk. Unfortunately, that seems to use just as many lines of code as mine does. I'd really like to streamline it if possible.
 
T

tomsk

Well-known member
VIP
That's the best you're going to get, unless you simply your logic
 
T

tomsk

Well-known member
VIP
@d4dahl Since you're into the Gann stuff, I found the following in my files from the Yahoo TOS Thinkscript group several years ago. Just something for you to check out. I must say all those lines look purty especially on a daily /ES chart. Sort of reminds me of John Carter's Voodoo Lines. Have fun out there!

Code:
# Gann Sq Of 9Time
# Yahoo TOS ThinkScript
# 6.27.2016

def h = highestall(high);

plot sh = h;
sh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
sh.SetDefaultColor(Color.RED);

def data45 = Sqrt(sh) - (45 / 180);
def data1 = Power(data45, 2);
plot line45 = data1;
line45.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line45.SetDefaultColor(Color.GREEN);

def data90 = Sqrt(sh) - (90 / 180);
def data2 = Power(data90, 2);
plot line90 = data2;
line90.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line90.SetDefaultColor(Color.GREEN);

def data135 = Sqrt(sh) - (135 / 180);
def data3 = Power(data135, 2);
plot line135 = data3;
line135.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line135.SetDefaultColor(Color.GREEN);

def data180 = Sqrt(sh) - (180 / 180);
def data4 = Power(data180, 2);
plot line180 = data4;
line180.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line180.SetDefaultColor(Color.GREEN);

def data225 = Sqrt(sh) - (225/ 180);
def data5 = Power(data225, 2);
plot line225 = data5;
line225.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line225.SetDefaultColor(Color.GREEN);

def data270 = Sqrt(sh) - (270 / 180);
def data6 = Power(data270, 2);
plot line270 = data6;
line270.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line270.SetDefaultColor(Color.GREEN);

def data315 = Sqrt(sh) - (315 / 180);
def data7 = Power(data315, 2);
plot line315 = data7;
line315.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line315.SetDefaultColor(Color.GREEN);

def data360 = Sqrt(sh) - (360 / 180);
def data8 = Power(data360, 2);
plot line360 = data8;
line360.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line360.SetDefaultColor(Color.GREEN);

def data405 = Sqrt(sh) - (405 / 180);
def data9 = Power(data405, 2);
plot line405 = data9;
line405.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line405.SetDefaultColor(Color.GREEN);

def data450 = Sqrt(sh) - (450 / 180);
def data10 = Power(data450, 2);
plot line450 = data10;
line450.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line450.SetDefaultColor(Color.GREEN);

def data495 = Sqrt(sh) - (495 / 180);
def data11 = Power(data495, 2);
plot line495 = data11;
line495.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line495.SetDefaultColor(Color.GREEN);
 
Last edited:
S

San

Member
2019 Donor
@tomsk, I have doubt, This code represent ( Tunnel mean ) Support line for Monthly /Weekly /Daily ..:)
 
mc01439

mc01439

Well-known member
2019 Donor
VIP
@d4dahl Since you're into the Gann stuff, I found the following in my files from the Yahoo TOS Thinkscript group several years ago. Just something for you to check out. I must say all those lines look purty especially on a daily /ES chart. Sort of reminds me of John Carter's Voodoo Lines. Have fun out there!

Code:
# Gann Sq Of 9Time
# Yahoo TOS ThinkScript
# 6.27.2016

def h = highestall(high);

plot sh = h;
sh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
sh.SetDefaultColor(Color.RED);

def data45 = Sqrt(sh) - (45 / 180);
def data1 = Power(data45, 2);
plot line45 = data1;
line45.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line45.SetDefaultColor(Color.GREEN);

def data90 = Sqrt(sh) - (90 / 180);
def data2 = Power(data90, 2);
plot line90 = data2;
line90.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line90.SetDefaultColor(Color.GREEN);

def data135 = Sqrt(sh) - (135 / 180);
def data3 = Power(data135, 2);
plot line135 = data3;
line135.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line135.SetDefaultColor(Color.GREEN);

def data180 = Sqrt(sh) - (180 / 180);
def data4 = Power(data180, 2);
plot line180 = data4;
line180.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line180.SetDefaultColor(Color.GREEN);

def data225 = Sqrt(sh) - (225/ 180);
def data5 = Power(data225, 2);
plot line225 = data5;
line225.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line225.SetDefaultColor(Color.GREEN);

def data270 = Sqrt(sh) - (270 / 180);
def data6 = Power(data270, 2);
plot line270 = data6;
line270.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line270.SetDefaultColor(Color.GREEN);

def data315 = Sqrt(sh) - (315 / 180);
def data7 = Power(data315, 2);
plot line315 = data7;
line315.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line315.SetDefaultColor(Color.GREEN);

def data360 = Sqrt(sh) - (360 / 180);
def data8 = Power(data360, 2);
plot line360 = data8;
line360.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line360.SetDefaultColor(Color.GREEN);

def data405 = Sqrt(sh) - (405 / 180);
def data9 = Power(data405, 2);
plot line405 = data9;
line405.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line405.SetDefaultColor(Color.GREEN);

def data450 = Sqrt(sh) - (450 / 180);
def data10 = Power(data450, 2);
plot line450 = data10;
line450.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line450.SetDefaultColor(Color.GREEN);

def data495 = Sqrt(sh) - (495 / 180);
def data11 = Power(data495, 2);
plot line495 = data11;
line495.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
line495.SetDefaultColor(Color.GREEN);

@tomsk - Thank You for sharing! Good Gann indicators for TOS are hard to come by. If you come across any others would be grateful if you passed on.
 
T

tomsk

Well-known member
VIP
@mc01439 Noted, if I see something related to that I will indeed make it a point to share. They don't get posted too often as I recall. Glad I had a couple in my files
 
d4dahl

d4dahl

New member
@mc01439 Just in case you haven't found it, there is one preloaded script on TOS entitled "MajorGannLevels."
 
mc01439

mc01439

Well-known member
2019 Donor
VIP
@mc01439 Just in case you haven't found it, there is one preloaded script on TOS entitled "MajorGannLevels."

@d4dahl - Thank You, yes I noticed that and have reviewed.
 

Similar threads

Top