thinkScript in Conditional Orders

In thinkorswim, orders can be automatically placed or canceled when a study-based condition is fulfilled. You can use both pre-defined and custom studies to define conditions for placing and canceling orders.

How to create rules for submission/cancellation

1. Click the gear icon in the Order Rules column  of the Order Entry form. The Order Rules window will appear.

2. Rules for order submission and cancellation can be set in the Conditions area. Order submission rules are listed on the left of the area, and cancellation rules are listed on the right.

3. Type in the desirable symbol name in the corresponding form. Click on the Method cell and choose "STUDY" from the drop-down list. Choose Edit... to open the Study Order Condition window.

4. You can use both the Condition Wizard and the thinkScript Editor to set your condition or define a numerical value, e.g., a study. When finished, click OK.

5. In the Trigger field of the form, specify whether you want your order added (cancelled) when your condition is true or false. For numerical values, you can choose triggering direction relative to threshold value (for example, order can be added when a certain study value becomes greater than the threshold value).

6. Carefully review your condition. In the Description box at the bottom, you can read a full text description of the rules you are about to set for the order. In addition, you can click on the gear icon in the Method field of the form to review the corresponding thinkScript code.

7. Click Save. Your order now has rules for submission and/or cancellation.

Specific Usage

In Conditional Orders, you can use either a regular study or an expression. Here is a list of thinkScript® usage peculiarities when applied to Conditional Orders:

  • You are free to use bid and ask functions;

  • Range-dependent functions (dealing with data from the whole chart, such as HighestAll) are not allowed;

  • Studies must have exactly one plot;

  • def variables cannot be used recursively.