Bestsellers Editors' Picks All audiobooks. Explore Magazines. Editors' Picks All magazines. Explore Podcasts All podcasts. Difficulty Beginner Intermediate Advanced. Explore Documents. Uploaded by iindicascribd.
Did you find this document useful? Is this content inappropriate? Report this Document. Flag for inappropriate content. Download now. ThinkScript User Manual. Related titles. Carousel Previous Carousel Next. Jump to Page. Search inside document. Email us at support thinkorswim. Put simply, thinkScript is a way to manipulate the closing, opening, high and low price of a stock or index, as well as the trading volume and volatility of a stock or index with a formula and then display the results on a chart.
Like building blocks, each element of thinkScript is, in itself, fairly simple but combining them together can yield some complex and powerful results. To begin using the thinkScript editor for studies, go to the Charts tab, click 'Studies' in the upper right corner of the page and select 'Edit Studies'.
This will open the 'Edit Studies' window. To use thinkScript to make a study of your own you now have two choices: To create a new study by fine-tuning an existing study, first find a study in the 'Available studies' list marked by the icon. Next click on the Blue Bullet next to the chosen study and click 'Copy This will open the 'New study' editor with the chosen study's definition preloaded.
To create your own study from scratch, simply click the 'New study' button in the bottom left corner of the 'Edit Studies' window.
Also, thinkScript code is not case-sensitive. These commands control the basic behavior of your thinkScript study. There are three current uses for declare: declare upper; This command places your study in the main chart window on top of the pricing bars.
You want an upper study if your study plot falls more or less within the same range as pricing. By default, all studies created with thinkScript are upper studies and you don't have to make this declaration. You want a lower study if your study is some complex value in the range of , i.
Every study contains at least on plot declaration without one, nothing would be displayed on the chart. For it to work, you must give the data you are trying to plot a name and then define what that data will represent. For example, if you want to plot the closing price of a stock, you can't simply write plot close; That won't work. This let's you construct complex formulas from simpler elements. In this case, SMA itself is not displayed on the chart because there is no plot declaration to do so.
An input is like a def that can be adjusted in the 'Edit Studies' window or in the 'Format Study' dialog found by right-clicking on a study line right on the graph. Rec is short for "recursion". You can specify these parameters in any order. Function Definitions AbsValue calculates the absolute value of some value.
If you do not specify a length for the data set, the default number of bars is The first parameter is the data type to compare on. First, it can be used on the right side of an equation bu using 3 parameters: a condition, a true value and a false value. Like between, the 'if' function will most likely be used as a test for a larger study. For example, data. This actually gives you a 20 day moving average. If you do not specify a length for the data set, the default 12 bars of data is used.
If the chart displays one year of data, totalsum will add up year. If you are looking at one month of data, totalsum will add up one month.
In an application or software such an input is called a 'select box'. You can create a select box in thinkScript by using a construction known as an 'enum'. In this case it's 'Mon'. In order to do something more powerful with the results of your select box rather than simply operate on the numeric value 0,1, Accessing Data From Another Symbol To access data from another symbol in your code, append the name of the symbol in quotes and parentheses to the data type you want to use.
Using Historical Data To access a value from a previous bar of data, you can use what is called [offset] syntax. Please note: in thinkScript, a positive number is used to refer to data in the past.
Negative numbers will give you bars in the future when working from historical data. Referencing Pre-Defined Studies thinkScript allows you to reference studies that are already available on the Charts tab in your code. You use the reference keyword to do this. So long as the study name is followed by parentheses, you don't need to include the word 'reference'.
You can change the parameters of the study within reference by inputting them between parentheses. To see the input parameters of a particular study, click on that study in the 'Edit Studies' section of the Charts tab. You will see the available parameters listed in the study properties section. However, you can specify the plot you want to reference, as well. Red ; Below the 'Functions' section in the right sidebar you will see that the definitions of some Constants are also provided.
At the top of the "New Study" editor is a field where you can name your study. Once you've provided the name, click the "Save" button and your new study can be applied to any chart like any of the pre- programmed studies. If you want to change the code in your custom study, return to the "Edit Studies" window by clicking the "Studies" button in the upper right hand corner of the Charts tab, then clicking on "Edit Studies".
Custom studies are marked with the icon. Click the blue bullet to the left of the name of the study and select "Edit source". That will return you to the study editor to make any changes. When strategies are drawn on a chart, buy and sell triggers appear in response to the conditions defined in the strategy. To begin using the thinkScript editor for strategies, go to the TOS Charts tab, click 'Studies' in the upper right corner of the page and select 'Edit Strategies'. This will open the 'Edit Strategies' window.
These strategies are actually based on studies and render buy and sell triggers when their underlying study meets a certain condition. Bitcoin Indicator. Theta Gang Indicators. Download ThinkorSwim. Log in. Install the app. Forums Explore JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly. You should upgrade or use an alternative browser. Learn ThinkorSwim Coding Language. Here are some resources to help you learn thinkScript, the official coding language for ThinkorSwim platform. Create your own strategies. Strategies are technical analysis tools that, in addition to analyzing data, add simulated orders to the chart so you can backtest your strategy.
Strategies can be created the same way as studies, however, they must contain the AddOrder function. This function defines what kind of simulated order should be added on what condition. Create your own watchlist columns.
0コメント