GANN Square Of 9 Indicator for ThinkorSwim

germanburrito,

I worked on my code until I got exhausted of debugging it. If I didn't have such a problem with ThinkScript, I would have also include an option for choosing either dynamic or static Gann Squares. Not many people know that there are different ways to plot SO9. Anyway, I already made a code like yours before I studied Michael Jenkins work. Gann said that all stocks, commodities, etc. have their own vibration; so the SO9 is not the only square -- it's just the most common. My code is intended to provide that accuracy.
i do think that they all have their own vibration, but I have discovered that they all have the same scale, ALL the stocks.
 
heres a code that also calculates the positive gann square of nine from yesterdays close, i am trying to code it so it can be switched from todays open is you wish. the code is there i just have it turned off.
Code:
#calculates gann square of 9 based on either todays open or yesterdays close.



input aggregationPeriod = AggregationPeriod.DAY;

def yesterday= close(period = aggregationPeriod)[1];
#def today = open(period = aggregationPeriod);


def sh= yesterday;

def data00 = Sqrt(sh) - (0 / 180);
def data0 = Power(data00, 2);
plot line00 = data0;


def data45 = Sqrt(sh) - (45 / 180);
def data1 = Power(data45, 2);
plot line45 = data1;
def up1 = sh- line45;
plot up11 = up1+ sh;
line45.SetDefaultColor(Color.GREEN);
up11.SetDefaultColor(Color.red);

def data90 = Sqrt(sh) - (90 / 180);
def data2 = Power(data90, 2);
plot line90 = data2;
def up2 = sh- line90;
plot up22= sh +up2;
up22.SetDefaultColor(Color.red);

line90.SetDefaultColor(Color.GREEN);

def data135 = Sqrt(sh) - (135 / 180);
def data3 = Power(data135, 2);
plot line135 = data3;
def up3 = sh- line135;
plot up33 = sh+ up3;
up33.SetDefaultColor(Color.red);

line135.SetDefaultColor(Color.GREEN);
 
@germanburrito @Hypoluxa are you supposed to use the previous day close or are you supposed to use the entry price for these levels?

We can use GetAveragePrice() function to determine if there is an active position and plot the lines.
 
@germanburrito @Hypoluxa are you supposed to use the previous day close or are you supposed to use the entry price for these levels?

We can use GetAveragePrice() function to determine if there is an active position and plot the lines.
yea that would be cool, I believe you could use whatever price you want to get the gann levels, i believe thats where the "art" lies, i know some people have been using the change of the macd from green to red and vice versa to input the gann levels, some use the price 15 minutes after open and some use the highest price or lowest price of the day, i believe that all these reasonable. however I don't know how to code all that.
 
yea that would be cool, I believe you could use whatever price you want to get the gann levels, i believe thats where the "art" lies, i know some people have been using the change of the macd from green to red and vice versa to input the gann levels, some use the price 15 minutes after open and some use the highest price or lowest price of the day, i believe that all these reasonable. however I don't know how to code all that.
I can help with that. If we can define a spec, I can add that into your code.
 
I can help with that. If we can define a spec, I can add that into your code.
im not sure what would be the best honestly! what do you think? i believe that maybe using the first william fractal after open might actually give good signals. possibly the fisrt swing high or swing low. what o you think? because besically what the code does its it plots high and low lvels of gann square of nine from whatever point you choose
Code:
input data= 0000.00;


def sh= data;

def data00 = Sqrt(sh) - (0 / 180);
def data0 = Power(data00, 2);
plot line00 = data0;


def data45 = Sqrt(sh) - (45 / 180);
def data1 = Power(data45, 2);
plot line45 = data1;
def up1 = sh- line45;
plot up11 = up1+ sh;
line45.SetDefaultColor(Color.GREEN);
up11.SetDefaultColor(Color.red);

def data90 = Sqrt(sh) - (90 / 180);
def data2 = Power(data90, 2);
plot line90 = data2;
def up2 = sh- line90;
plot up22= sh +up2;
up22.SetDefaultColor(Color.red);

line90.SetDefaultColor(Color.GREEN);

def data135 = Sqrt(sh) - (135 / 180);
def data3 = Power(data135, 2);
plot line135 = data3;
def up3 = sh- line135;
plot up33 = sh+ up3;
up33.SetDefaultColor(Color.red);

line135.SetDefaultColor(Color.GREEN);
 
@germanburrito @Hypoluxa are you supposed to use the previous day close or are you supposed to use the entry price for these levels?

We can use GetAveragePrice() function to determine if there is an active position and plot the lines.
I'm new to using it...tomorrow makes a week...but all you do for GANN is type in the current price and it gives you targets of resistance and support. I've read in a couple of places to update the current price at certain times of the day:
30 mins after open
Then 90 mins after open
Lunchtime 12-1
and again around 2:00
It has been suggested to not update for trading after 3:00.

here's the link I use: https://www.stockmaniacs.net/freebies/free-tools/gann-square-of-9-calculator/

I also have this in an excel spreadsheet if anyone wants it.
 
What's the best time to begin using this? 15mins after open? 30mins? etc..
And how often should it be updated throughout the day?
Hey Hypoluxa, thanks for bringing this GANN Square of Nine to our attention. It does seen uncanny although not 100% accurate. Thanks to German Burrito for the code but I am not sure if the code is as easy to use as that website you referenced. Simply enter the number and out pops the targets to look for. Are you using the website calculator or the code here?
 
Hey Hypoluxa, thanks for bringing this GANN Square of Nine to our attention. It does seen uncanny although not 100% accurate. Thanks to German Burrito for the code but I am not sure if the code is as easy to use as that website you referenced. Simply enter the number and out pops the targets to look for. Are you using the website calculator or the code here?
I just use the website and spreadsheet...that way I keep my chart clean. Its unbelievably accurate so far for SPX and AMZN. That's the only two I watch all day to trade options with.
 
I just use the website and spreadsheet...that way I keep my chart clean. Its unbelievably accurate so far for SPX and AMZN. That's the only two I watch all day to trade options with.
Do you use it at the current price? or certain times of day like you suggested? If so, it can be automated.
 
Do you use it at the current price? or certain times of day like you suggested? If so, it can be automated.
I update the price at each of those time frames I mentioned....also, I'll update it when I feel a run is about over with a color change in a MACDBB dot...like I tested today with SPX when it hit $3845 and a dot went red...then a red candle.
 
I update the price at each of those time frames I mentioned....also, I'll update it when I feel a run is about over with a color change in a MACDBB dot...like I tested today with SPX when it hit $3845 and a dot went red...then a red candle.
Do you mean you picked $3845? because today's high for SPX shows $3843.67.
 
I update the price at each of those time frames I mentioned....also, I'll update it when I feel a run is about over with a color change in a MACDBB dot...like I tested today with SPX when it hit $3845 and a dot went red...then a red candle.

I am not seeing a red dot when the price hit $3845, can u please help understand what time you checked?

IKC6MrG.png
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
620 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