Finding Script Examples | thinkScript Studies on thinkorswim | 6-28-24

Education


Introduction

Good afternoon and welcome to this session on thinkScript studies on thinkorswim. My name is Ben Watson. I'm an Education Coach and Senior Manager here at Charles Schwab. Joining me out there in the chat is my good friend Kevin Herer, a 20-plus year veteran in the financial markets, who will be helping to answer your questions.


Setting the Stage

Whether you're watching this live or as a recorded version, thank you for joining. Today, we embark on a journey of self-discovery in thinkScript coding. The intention of this webcast isn’t to claim expertise but rather to understand how to learn thinkScript if you’re not inherently a coder.

Before we dive in, a couple of housekeeping items:

  • Everything discussed today is for illustrative and educational purposes.
  • This discussion shouldn’t be considered individualized recommendations about security or patterns.
  • We’ll be using thinkorswim’s paper money platform.
  • Remember, options carry risk and aren't suitable for all investors.
  • Investing involves the risk of loss, and past performance is not indicative of future success.

Roadmap for thinkScript Study

To begin, the journey with thinkScript often starts with identifying what you want your strategy to accomplish. Here's a simplified process:

  1. Identify your goal.
  2. Determine if thinkScript can achieve that goal.
  3. Figure out the steps needed to build the script.
  4. Apply the tools and write custom scripts.
  5. Click, compare, and test the results.

We'll be using the thinkorswim paper money platform to look at moving averages and their relation to thinkScript.


Exploring thinkScript Code

Let's take a look at a simple moving average. To inspect the code behind it:

  1. Go to the study set.
  2. Click on the scroll icon on the left-hand side.
  3. A script snippet will appear, providing insight into the code.

This simple moving average script includes:

  • Inputs: Allows you to change parameters like price, length, displacement, etc.
  • Plotting: Defines how the simple moving average is calculated.
  • Signals: Determines up and down signals based on price crossing the moving average.
  • Display Characteristics: Customizes colors and display features on the chart.

This helps understand the building blocks of thinkScript, facilitating the modification or creation of new scripts.


Strategies in thinkScript

ThinkScript is powerful in strategies:

  1. For example, a moving average crossover strategy can be defined to add buy and sell orders.
  2. Moving averages can help define signals between two different moving averages.

To add strategies:

  1. Add a moving average strategy, using the gear icon to set inputs.
  2. Define crossovers for buy and sell signals.
  3. This strategy will show entries and exits on the chart and include floating p&l for running account status.

Using AI to Generate thinkScript

For more complex strategies:

  1. Use AI tools to generate thinkScript code, helping create new scripts or strategies.
  2. Copy-paste the AI generated code into the thinkorswim platform and test the script.

Conclusion

Summarizing:

  1. Discover and learn about existing studies by inspecting scripts.
  2. Use pre-built studies and strategies as a foundation to create new ones.
  3. AI can be an excellent tool to help create thinkScript code.

Remember to frequently use the thinkScript manual and toolbox available on the thinkorswim platform.

Thank you to everyone, especially Kevin Herer for the help, and we wish you great success in your journey with thinkScript!


Keywords

  • thinkScript
  • thinkorswim
  • moving average
  • strategies
  • AI tools
  • coding
  • study set
  • floating p&l

FAQs

Q1: What is thinkScript? A1: thinkScript is a scripting language used on the thinkorswim platform to create custom technical analysis indicators and strategies.

Q2: How do I understand the code for a moving average? A2: Inspect the thinkScript code by clicking on the scroll icon next to the study set. The code will show inputs, plot, signals, and display characteristics.

Q3: What is the 'displace' function in thinkScript? A3: The 'displace' function adjusts the moving average forward or backward by a chosen number of periods, effectively reducing or increasing the lag.

Q4: How can I build a custom strategy? A4: Start by adapting existing strategies or using snippets from built-in studies. Use tools like 'add order' in your custom scripts for defining buy and sell signals.

Q5: Can AI help in creating thinkScript code? A5: Yes, AI tools can generate base thinkScript code for various strategies, which can then be tested and modified on the thinkorswim platform.