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 specifics when applied to Conditional Orders:

  • You are free to use bid and ask functions;

  • Studies must have exactly one plot.

Entering a Market Order

Market orders are intended to buy or sell a specified quantity of contracts or shares at the next available market price. To place a Market Order in Active Trader, make sure you’ve chosen the correct quantity in the second line of the Big Buttons panel and click Buy MKT or Sell MKT. Proceed with order confirmation.

Entering Stop/Limit Orders

  1. Adjust the quantity in the second line of the Big Buttons panel.
  2. Hover the mouse over Bid Size or Ask Size column in the Active Trader ladder. You will see a bubble in the Buy Orders or Sell Orders column, e.g., BUY +1 STOP. This bubble indicates trade direction, quantity and order type while its location determines the price level at which the order will be entered.
  3. Click at the desired price level:
    • In the Bid Size column, clicking above the current market price will add a buy stop order; clicking below or at the market price, a buy limit order.
    • In the Ask Size column, clicking below the current market price will add a sell stop order; clicking above or at the market price, a sell limit order.
  4. Proceed with order confirmation

A stop order will not guarantee an execution at or near the activation price. Once activated, they compete with other incoming market orders.
With a stop limit order, you risk missing the market altogether. In a fast-moving market, it might be impossible to execute an order at the stop-limit price or better, so you might not have the protection you sought.

 

Entering a First Triggers Order

  1. A 1st Triggers (First Triggers) order is a compound operation where an order, once filled, triggers execution of another order (or other orders). To add a 1st Triggers order in Active Trader, do the following:
  2. In the second line of the Big Buttons panel, choose TRG w/bracket. This will display a new section which represents two additional orders: Limit and Stop.
  3. Decide which order (Limit or Stop) you would like to trigger when the first order fills. Disable the other.
  4. Adjust the quantity and time in force.
  5. Specify the offset. Offset is the difference between the prices of the orders. It can be specified as a dollar amount, ticks, or percentage.
  6. Hover the mouse over the Bid Size or Ask Size column, depending on the type of the first order you would like to enter. Note how Active Trader adds an additional bubble in the other column, e.g., TRG+1.00 STP.
  7. Click at the desired price level:
    • In the Bid Size column, clicking above the current market price will add a buy stop order; clicking below or at the market price, a buy limit order.
    • In the Ask Size column, clicking below the current market price will add a sell stop order; clicking above or at the market price, a sell limit order.
  8. Proceed with order confirmation.
  9. Once you send the order and it starts working, you will see two bubbles appear in both Bid Size and Ask Size columns. While the first order is still working, you can drag its bubble along the price ladder so its price will change: after confirmation, the second bubble will also change its position to maintain the offset you specified at Step 4. To cancel the entire 1st Triggers order, just click ‘x’ in its bubble in the ladder.

Entering a First Triggers OCO Order

An OCO (One Cancels Other) order is a compound operation where an order, once filled, cancels execution of another order. It may be used as the triggered order in a First Triggers so that when the first order fills, both OCO orders become working; when either of the latter is filled, the other is canceled.

To add a 1st Triggers OCO order in Active Trader, repeat all steps from Entering a First Triggers (above), but keep both orders from Step 2 enabled.

Using Order Bubbles in Active Trader Ladder

When you add an order in Active Trader and it starts working, it is displayed as a bubble in the ladder. Bubbles indicate order price, trade direction, and quantity - and they can also be used for order editing or cancelation. Dragging a bubble along the ladder will change the price, so when you drag-and-drop, you will see another order confirmation dialog (unless Auto send option is enabled, which we recommend to avoid). Once you confirm and send, the bubble will take its new place and the order will start working with this new price. To cancel an order, you can just click ‘x’ in its bubble.

All of the above may be especially useful for 1st triggers and 1st triggers OCO orders. Dragging the first working order along the ladder will also re-position the orders to be triggered so that they maintain their offset. Clicking ‘x’ in the working order’s bubble will cancel both the working order and those to be triggered by it. Note that dragging the bubble of an order waiting for trigger will not re-position the bubble of the working order: this will only change the offset between them. Canceling an order waiting for trigger will not cancel the working order.