# Psychological Whole Figures and Levels in ThinkOrSwim

#### 3AMBH

##### Active member
2019 Donor
Hi,

Anyone have a Whole Number Indicator for stocks?

Thanks
2AMBH

Came across this on Sept 18, 2020. Seems to work in TOS on stocks

http://tos.mx/twqPQe

Will aggregate down to 1 minute

Code:

Code:
``````input aggregationPeriod = AggregationPeriod.fOUR_HOURS;

input lo = yes; #hint lo: line every 10\$
input l = yes;  #hint l: line every 1\$
input o = yes; #hint o: line every 0.1\$
input oo = yes; #hint oo: line every 0.01\$
input ooo = yes; #hint ooo: line every 0.001\$

#by lawrencevkim 20/08/2015
DefineGlobalColor("10", Color.VIOLET);
DefineGlobalColor("1", Color.BLUE);
DefineGlobalColor("0", Color.RED);
DefineGlobalColor("00", Color.MAGENTA);
DefineGlobalColor("000", Color.DARK_ORANGE);

def lo_price = if lo then Round(close(period = aggregationPeriod)[1], -1) else Double.NaN;

plot lo_price_1 = lo_price;
lo_price_1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_1.SetDefaultColor(GlobalColor("10"));
plot lo_price_2 = lo_price + 10;
lo_price_2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_2.SetDefaultColor(GlobalColor("10"));
plot lo_price_3 = lo_price + 20;
lo_price_3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_3.SetDefaultColor(GlobalColor("10"));
plot lo_price_4 = lo_price + 30;
lo_price_4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_4.SetDefaultColor(GlobalColor("10"));
plot lo_price_5 = lo_price - 10;
lo_price_5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_5.SetDefaultColor(GlobalColor("10"));
plot lo_price_6 = lo_price - 20;
lo_price_6.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_6.SetDefaultColor(GlobalColor("10"));
plot lo_price_7 = lo_price - 30;
lo_price_7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
lo_price_7.SetDefaultColor(GlobalColor("10"));

def l_price = if l then Round(close(period = aggregationPeriod)[1], 0) else Double.NaN;

plot l_price_1 = l_price;
l_price_1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_1.SetDefaultColor(GlobalColor("1"));
plot l_price_2 = l_price + 1;
l_price_2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_2.SetDefaultColor(GlobalColor("1"));
plot l_price_3 = l_price + 2;
l_price_3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_3.SetDefaultColor(GlobalColor("1"));
plot l_price_4 = l_price + 3;
l_price_4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_4.SetDefaultColor(GlobalColor("1"));
plot l_price_5 = l_price + 4;
l_price_5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_5.SetDefaultColor(GlobalColor("1"));
plot l_price_6 = l_price + 5;
l_price_6.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_6.SetDefaultColor(GlobalColor("1"));
plot l_price_7 = l_price - 1;
l_price_7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_7.SetDefaultColor(GlobalColor("1"));
plot l_price_8 = l_price - 2;
l_price_8.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_8.SetDefaultColor(GlobalColor("1"));
plot l_price_9 = l_price - 3;
l_price_9.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_9.SetDefaultColor(GlobalColor("1"));
plot l_price_10 = l_price - 4;
l_price_10.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_10.SetDefaultColor(GlobalColor("1"));
plot l_price_11 = l_price - 5;
l_price_11.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
l_price_11.SetDefaultColor(GlobalColor("1"));

def o_price = if o then Round(close(period = aggregationPeriod)[1], 1) else Double.NaN;

plot o_price_1 = o_price;
o_price_1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
o_price_1.SetDefaultColor(GlobalColor("0"));
plot o_price_2 = o_price + 0.1;
o_price_2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
o_price_2.SetDefaultColor(GlobalColor("0"));
plot o_price_3 = o_price + 0.2;
o_price_3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
o_price_3.SetDefaultColor(GlobalColor("0"));
plot o_price_4 = o_price + 0.3;
o_price_4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
o_price_4.SetDefaultColor(GlobalColor("0"));
plot o_price_5 = o_price - 0.1;
o_price_5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
o_price_5.SetDefaultColor(GlobalColor("0"));
plot o_price_6 = o_price - 0.2;
o_price_6.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
o_price_6.SetDefaultColor(GlobalColor("0"));
plot o_price_7 = o_price - 0.3;
o_price_7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
o_price_7.SetDefaultColor(GlobalColor("0"));
plot o_price_8 = o_price - 0.4;
o_price_8.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
o_price_8.SetDefaultColor(GlobalColor("0"));
plot o_price_9 = o_price - 0.5;
o_price_9.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
o_price_9.SetDefaultColor(GlobalColor("0"));
plot o_price_10 = o_price + 0.4;
o_price_10.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
o_price_10.SetDefaultColor(GlobalColor("0"));
plot o_price_11 = o_price + 0.5;
o_price_11.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
o_price_11.SetDefaultColor(GlobalColor("0"));

def oo_price = if oo then Round(close(period = aggregationPeriod)[1], 2) else Double.NaN;

plot oo_price_1 = oo_price;
oo_price_1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
oo_price_1.SetDefaultColor(GlobalColor("00"));
plot oo_price_2 = oo_price + 0.01;
oo_price_2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
oo_price_2.SetDefaultColor(GlobalColor("00"));
plot oo_price_3 = oo_price + 0.02;
oo_price_3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
oo_price_3.SetDefaultColor(GlobalColor("00"));
plot oo_price_4 = oo_price + 0.03;
oo_price_4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
oo_price_4.SetDefaultColor(GlobalColor("00"));
plot oo_price_5 = oo_price + 0.04;
oo_price_5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
oo_price_5.SetDefaultColor(GlobalColor("00"));
plot oo_price_6 = oo_price + 0.05;
oo_price_6.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
oo_price_6.SetDefaultColor(GlobalColor("00"));
plot oo_price_7 = oo_price - 0.01;
oo_price_7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
oo_price_7.SetDefaultColor(GlobalColor("00"));
plot oo_price_8 = oo_price - 0.02;
oo_price_8.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
oo_price_8.SetDefaultColor(GlobalColor("00"));
plot oo_price_9 = oo_price - 0.03;
oo_price_9.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
oo_price_9.SetDefaultColor(GlobalColor("00"));
plot oo_price_10 = oo_price - 0.04;
oo_price_10.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
oo_price_10.SetDefaultColor(GlobalColor("00"));
plot oo_price_11 = oo_price - 0.05;
oo_price_11.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
oo_price_11.SetDefaultColor(GlobalColor("00"));

def ooo_price = if ooo then Round(close(period = aggregationPeriod)[1], 3) else Double.NaN;

plot ooo_price_1 = ooo_price;
ooo_price_1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ooo_price_1.SetDefaultColor(GlobalColor("000"));
plot ooo_price_2 = ooo_price + 0.001;
ooo_price_2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ooo_price_2.SetDefaultColor(GlobalColor("000"));
plot ooo_price_3 = ooo_price + 0.002;
ooo_price_3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ooo_price_3.SetDefaultColor(GlobalColor("000"));
plot ooo_price_4 = ooo_price + 0.003;
ooo_price_4.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ooo_price_4.SetDefaultColor(GlobalColor("000"));
plot ooo_price_5 = ooo_price + 0.004;
ooo_price_5.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ooo_price_5.SetDefaultColor(GlobalColor("000"));
plot ooo_price_6 = ooo_price + 0.005;
ooo_price_6.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ooo_price_6.SetDefaultColor(GlobalColor("000"));
plot ooo_price_7 = ooo_price - 0.001;
ooo_price_7.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ooo_price_7.SetDefaultColor(GlobalColor("000"));
plot ooo_price_8 = ooo_price - 0.002;
ooo_price_8.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ooo_price_8.SetDefaultColor(GlobalColor("000"));
plot ooo_price_9 = ooo_price - 0.003;
ooo_price_9.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ooo_price_9.SetDefaultColor(GlobalColor("000"));
plot ooo_price_10 = ooo_price - 0.004;
ooo_price_10.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ooo_price_10.SetDefaultColor(GlobalColor("000"));
plot ooo_price_11 = ooo_price - 0.005;
ooo_price_11.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ooo_price_11.SetDefaultColor(GlobalColor("000"));``````

Last edited by a moderator:

87k+ Posts
392 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?