Aggregation Periods By Millisecond. For ThinkOrSwim

Yes it does and it shows it where you change the timeframe. I'm looking to see if there is a way to put it on the chart as a white label as it's easier to see than the screenshot above with the ticker, d/m and [NASDAQ].

Oh okay... got ya. Well, it's annoying but it can be done. You'd have to do the following but define all of the aggregation periods by millisecond.

Ruby:
def AP=getaggregationperiod();

addLabel(1,
if AP==86400000 then "Daily" else
if AP==60000 then "1min" else
if AP==300000 then "5min" else
"Other", color.white);

Do that for all the timeframes and you should be good.

Aggregation Periods By Millisecond
1 min = 60,000
2 min = 120,000
3 min = 180,000
4 min = 240,000
5 min = 300,000
10 min = 600,000
15 min = 900,000
20 min = 1,200,000
30 min = 1,800,000
1 hr = 3,600,000
2 hr = 7,200,000
4 hr = 14,400,000
Daily = 86,400,000
Weekly = 604,800,000
Monthly = 2,592,000,000
 
Last edited by a moderator:
Oh okay... got ya. Well, it's annoying but it can be done. You'd have to do the following but define all of the aggregation periods by millisecond.

Ruby:
def AP=getaggregationperiod();

addLabel(1,
if AP==86400000 then "Daily" else
if AP==60000 then "1min" else
if AP==300000 then "5min" else
"Other", color.white);

Do that for all the timeframes and you should be good.

1 min = 60,000
2 min = 120,000
3 min = 180,000
4 min = 240,000
5 min = 300,000
10 min = 600,000
15 min = 900,000
20 min = 1,200,000
30 min = 1,800,000
1 hr = 3,600,000
2 hr = 7,200,000
4 hr = 14,400,000
Daily = 86,400,000
Weekly = 604,800,000
Monthly = 2,592,000,000
I would like to know whether ThinkorSwim provides 10-second, 20-second and 30-second charts as Tradingview does.
 
I like using this when I use the flexible grid and can't see the timeframes.

Code:
def AP=getaggregationperiod();

addLabel(1,

if AP==60000 then "1M" else
if AP==120000 then "2M" else
if AP==180000 then "3M" else
if AP==240000 then "4M" else
if AP==300000 then "5M" else
if AP==600000 then "10M" else
if AP==900000 then "15M" else
if AP==1800000 then "30M" else
if AP==3600000 then "1H" else
if AP==7200000 then "2H" else
if AP==14400000 then "4H" else
if AP==86400000 then "D" else
if AP==604800000 then "W" else
if AP==2592000000 then "M" else
"Other", color.white);
 

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
443 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