Condition Wizard allows you to build conditions using logical expressions. Since the Condition Wizard does not require special thinkScript® knowledge, it is useful for new users. It is an alternative to the thinkScript Editor in the Edit Studies... dialog. You can also use this feature to create Study Alerts, Custom Quotes, or Study Filters.
To open the Condition Wizard:
- Open the Charts interface.
- Navigate to Studies > Edit studies.
- Select the Studies tab and click Create.
- Switch to the Condition Wizard tab.
- Click Add condition to launch the Edit Condition window.
Using the Edit Condition window, you can perform logical checks between two expressions. Available options are:
- Value. Use numeric values.
- Study. Use pre-existing thinkorswim studies.
- Function. Use built-in thinkScript® functions.
- Price. Use any Fundamental function.
To select the first expression, click the dropdown menu and pick one of the available options. Then proceed to customize available parameters. Ensure you specify a value for parameters marked with O.
Note that for studies with multiple plots, only one will be analyzed (by default, the first plot on the list). Change the required plot using the dropdown menu.
Use the second column to specify the relation between the first and second expressions. Available options are written using human-readable syntax.
Finally, move on to the next column to create the second expression.
Example
Imagine you want to check when a 5-period simple moving average crosses above a 20-period one. Using Condition Wizard, follow the steps below:
- Open the Add condition dialog window.
- Define the first expression by opening the dropdown menu and selecting Study.
- Select SimpleMovingAvg.
- Keep default values for price, displace, and show breakout signals parameters; change the length parameter to 5.
- Select crosses above as the relation between the expressions.
- Configure the second expression similarly to the first; change the length parameter to 20.
- Click Save to add the condition to the Conditions list.
Note that this condition uses the same study for both expressions but changes the length parameter. When creating conditions, ensure the first and second expressions result in helpful data. For example, comparing two Value expressions will always resolve to true or false (e.g., three is never equal to four).
When configuring your expressions, you may notice two extra options:
- Offset. Allows you to calculate the value of a specified number of bars prior or ahead of the current one. See the reference guide for more information.
- Within. Available when configuring the second condition; it allows you to check if your condition was true at least once for a specified number of bars. See the reference guide for more information.
Condition comparison
The Condition Wizard supports more complex conditions. It may be useful to compare two or more conditions simultaneously. Condition comparison is done by selecting one of the following operators from the Check if dropdown menu:
- Any. Checks if any of the conditions is true (thinkScript® or operator).
- All. Checks if all the conditions are true (thinkScript® and operator).
The Condition Wizard applies the same operator (any or all) to all conditions in your Condition list. To mix both operators, switch to thinkScript Editor. Note that you’ll only be able to return to the Condition Wizard after restoring the same operator for all conditions. To get started with thinkScript®, see the reference guide.