thinkScript® IDE

The thinkScript® Integrated Development Environment (IDE) is a dedicated thinkorswim interface that can help you create, edit, and manage your thinkScript®-based studies. It has everything that thinkScript® Editor can offer and, in addition, it allows you to use any of the existing studies (both predefined and user-defined), keep multiple script tabs open, and detach the window (available by clicking on the Detach button). Note that when you open thinkScript® IDE in a detached window, the system displays it in its empty state.

Managing scripts in thinkScript® IDE

When you open thinkScript® IDE for the first time, you are prompted to create or open a study or a strategy. To do this:

  1. Click on the Add button  in the top right corner of the window. In the dropdown that appears, select Study or Strategy, depending on what you wish to create. Remember: strategies should have at least one simulated order while studies must have none.

     

  2. Alternatively, you can select a study or a strategy from the pane on the left. The list of studies and strategies in this pane is consistent with the list in Studies > Edit studies... in the Charts interface and Chart gadget. Use the dropdown above the list to choose which studies and strategies to show: predefined, user-defined, or all. If you open a script that has already been opened in the main or the detached window, you will be redirected to that window.

     

  3. Note that you can only edit user-defined studies and strategies, but you have an option to open a predefined script and save it as one of your own. To do so, click on the Show Action Menu button  in the top right corner and click Duplicate... Specify the new study name and click Create...

     

  4. You can use a .ts file from your computer to import a script into thinkScript® IDE. To do so, click on the Import button  in the top right corner, specify whether you wish to import a study or a strategy, navigate to the file on your computer, and click Open. 

All the scripts you create or open are shown as tabs above the toolbar. 

Editing scripts in thinkScript® IDE

You can work with your scripts almost the same way you do in thinkScript Editor®:

  1. Type your code in the text editor. The editor automatically parses your code as you type: valid elements are highlighted according to their syntax role. Invalid elements are shown in red; you can find details on the errors in your script directly below it.
    Note: When your code is empty or can be broken down into individual conditions or expressions, you can use Condition Wizard, an interface that allows you to create conditions or logical expressions without using thinkScript. To switch to it, click on the Condition Wizard button in the top right corner of the window.
  2. Use the toolbar:
    • Undo. Click to undo your last action. You can undo up to 50 last actions.
    • Reformat code. Click this button to make your code more readable.
    • Options. Click this button to access the Options menu. In this menu, you can turn on and off auto-complete functionality, change font settings, or discard all setting changes.
    • Help on thinkScript®. Click this button to open Learning Center on the Education tab.

       

  3. Use Reference library/Inspector. Using the library tree, you can find all the existing thinkScript® entities: functions, constants, reserved words, etc. In addition, you can find existing studies. Clicking on any name on this list will display a description in the description box below the tree. Double-clicking on any name will insert it into the text editor.
    Inspector, by default, shows you a virtual numpad and a dropdown that allows you to insert an existing study name in your code. This view mode is shown when the text cursor is in whitespace. When the text cursor is placed inside a study or function name, Inspector displays a panel that allows you to modify input parameters of that study or strategy.
  4. You can rename, duplicate, export, share, and delete your scripts using the right-click menu in the left-hand pane.
  5. Use Change History/Save area. This area allows you to save your script and manage its versioning. See details below.

Change History

Change History is a functionality that allows you to store multiple versions of a script, label some of the versions, and revert changes. Here is how you can use it:

  1. Every time you make changes to your script and click Save, the system stores your script version in Change History. To view the list of the stored versions, click on the Change History dropdown above your script.

     

  2. You can view the code of each version in Change History; however, you cannot edit it. Only the current version can be edited.
  3. You can restore any of the versions in Change History, i.e., make it the current version that can be edited. To do so, select the version you would like to restore and click Restore this version.
    Note: this will erase any changes you’ve made in the current version. Consider clicking Save first to store the current version. You can also click Undo to undo restoring of a past version.
  4. Consider labeling your script versions so you will be able to tell one from another. To do so, select a version you would like to label and click on the label icon. Type in the desirable label and click OK. The label will be displayed next to this version’s name on the list.

     


    Note: you can only have up to ten labeled versions. In addition, you can have up to 20 unlabeled ones. The system automatically replaces older unlabeled versions when this limit is reached. Always label the most important versions.
  5. To remove a label from a version, click on the Change History dropdown and navigate to Remove label. Click on the version with the label you would like to remove.
  6. You can save any of the versions as a new study or strategy. To do so, select the version you would like to save in the Change History dropdown and click Save as new script... Specify the name of the study or strategy and click Save.
    Note: When you add a study or strategy with a script that has multiple versions, the system will calculate it based on its current-version script. If you would like to calculate it based on another version, consider restoring that version as the current one or saving it under a different name.
  7. When you edit the same script in different instances of thinkorswim, it is saved as different versions of the same script.