Thinkscript Overview


Think or Swim is my broker, and they are great. Lower commissions than full retail, pretty good tools, and you can trade stocks, options and futures from same account. They have a web-based platform, which is important to me as a backup. Plus, ToS also updates their software regularly, adding features and killing bugs.

Thinkscript is Think or Swim’s code for creating customized indicators, paintbars, and even strategies. It doesn’t support automated trading, but it does give you a lot of control over what you see and how you see it. ToS spends lots of time doing good work on the software, but the documentation of Thinkscript is utterly abysmal improving somewhat. There is a dearth of information about Thinkscript on the web at large. These are some other bloggers I have found so far that work with the code:

I got some good ideas and early understanding of the code from their sites. Other than that, it seems that ToS script developers are all on their own. Well, the age of darkness is past! See my Google download site for a listing of indicators I have written, including source code. You can also find things by browsing the “Thinkscript” tag from the sidebar. Also, I have a tutorial for how to apply the scripts to your charts.

Feel free to contact me if you have questions or need any custom work done.

“If you’re good at something, never do it for free!!”

(Yes, I will answer questions for free. I’m a pushover)

17 Responses to “Thinkscript Overview”

  1. Todd Says:

    I’ve just recently come across your site and have been passing it on to other fellow traders. Great work!

    I’ve got a quick question. Do you know how to get strategy data on periods less than a day for longer than 20 days with thinkscript?


  2. jason Says:

    Great blog, been following you for a while and thanks for helping us small guys out. I have a question, can you create a code where i have a color code that follows the first 5 or 15 min bar and then changes a different color at the start of the next bar. The strategy is to buy right above the first break of either the first 5 or 15 min bar and it will change color from the opening range which makes it easier to see., if that helps you understand what I am looking for.. Thank you and keep up the great website.


  3. Prospectus Says:

    Yes, try my “shaded opening range” indicator:

    If that’s not what you mean, let me know!

  4. Adam Says:

    Love your work. Can’t find your email address for one of my questions: Have you been able to get dynamic hide to work properly? For some reason I can’t and I would also love to get pivot points for today only. Any help would be appreciated. THanks

  5. Prospectus Says:


    Yes I have. I’ve got it working in one of my own beta pivot scripts. I’ll clean it up and do a post on it when I get some time.

  6. Carroll B. Merriman Says:

    Forex trading really changed my life, although I must admit I really battled to get my head around some of the concepts, once I got going for real I have been doing really well.

  7. Lee Hustead Says:

    The TOS thinkscript manual says not a word about the math function (their category) named “crossover”. The scripts that come with TOS all use this function in exactly the same way. The term “crossover” is used as a process description so web searches don’t help. The statement definition under functions hasn’t helped me. Can you describe and/or illustrate its general use or send me a URL that does this. == Thanks, Lee

  8. Technical Analysis Links « GC's Market Page Says:

    […] Read the Prospectus, a thinkscript blog, (thinkscript overview) […]

  9. guy halamish Says:

    I wonder if by chance you have a script or anything along the lines I am looking for some timer or a way to flag ( alram /indicator ) that points the last 10 seconds of every 5 minute bar during the day .

    Some how a way to inform the trader that the 5 minute bar is about to finish ?

    I have seen some suggestions about Def start time and Def end time in seconds ,, but not sure how to code this into meaningfull alert or flag


    guy H

  10. Prospectus Says:

    Interesting! I’ll look into that.

  11. Prospectus Says:

    I looked at this, and it seems that the time functions only operate on the open of the bar. I’ll keep thinking about it in future, and maybe I’ll think of a way around it.

  12. guy halamish Says:

    I actually had a suggestion from another indiv. that looks very good his suggestion is

    Def start = secondsFromTime(0000)/300%1==0;
    Def end = secondsFromTime(0000)/310%1==0;

    which actually marks first 10 seconds of every 5 minute bar ,
    this looks great to me and I owe him ,, I say preety good and clever way .

    , All I need now is to turn this into a flag which I am working on , if you have a quick fix feel free ,to express your creative programming .

    Also if you have comments on this suggestion by Bob these will be appreciated

  13. Prospectus Says:

    That definition is great, but TOS doesn’t process the time intrabar. It only looks at the opening timestamp. Secondsfromtime and Secondstilltime don’t use the current time, they use the bar opening time. The value returned from those functions doesn’t change intrabar, so you can’t currently use those functions to get a bar timer.

  14. guy halamish Says:

    well possibly the hard way can be coding every 5 min as time

    0930 0935
    0935 0940
    0940 0945

    etc. and then testing if secondsfrom < 10 for each one is true

    will get the flag for the first 10 sec of every 5 min bar

    your thoughts?

  15. Says:

    Does thinkscript have the capability of searching for strike prices and premiums and applying those in a formula to determine if the result is + or negative and then to search for all positive results over the universe of options?

    Mike 609-412-5450

  16. JinD Says:

    Nice stuff. I use a lot of watchlist custom columns for true/false indicator values based of study codes and was wondering if you have code to indicate if the current day’s first 5min or 15 min volume is greater then the average of the x-days’ first bar. Thank for any help you can provide.

  17. Says:

    Very great post. I just stumbled upon your blog and wanted to say that I have truly enjoyed browsing your weblog posts.
    After all I’ll be subscribing for your feed and I am hoping you write again soon!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: