thinkScript language guide

thinkorswim Scripts: What thinkScript Can Build

thinkScript is thinkorswim code for chart studies, simulated strategies, watchlist columns, alerts, and scan conditions. The output is evaluated as a time series across chart bars.

Source review completed

Prompt brief

ThinkScript · one source file

Review in thinkorswim

Example request

Write a lower thinkScript study that plots a 20-bar relative volume ratio, colors values above 1.5 blue, and exposes the lookback and threshold as inputs.

Editable sourceFocused revisionsNative editor check

Direct answer

A thinkorswim script is source code written in thinkScript. Most chart scripts are studies that calculate plots, labels, colors, or alerts, or strategies that add simulated orders for historical analysis. Pineify can generate and revise one editable study or strategy file from a plain-English specification.

What to know first

  • thinkScript calculations operate on bar-by-bar data series.
  • Inputs make script behavior configurable without editing source.
  • Strategy orders are chart simulations, not live order placement.

Reference points

Keep the calculation explicit

Study
Calculates plots, labels, colors, clouds, or alert conditions on a chart.
Strategy
Uses simulated orders to analyze specified entry and exit rules on historical chart data.
Input
Exposes a configurable value such as length, price source, threshold, or color choice.
Plot
Defines a visible numeric series and its display properties.

How thinkScript differs from general-purpose code

The thinkorswim coding language is designed around market data series. A reference such as close represents the current bar and its history, while close[1] refers to the prior bar. This makes many indicator formulas concise, but it also means aggregation, offsets, and missing values affect the result.

A script usually declares inputs, defines intermediate series, and produces one or more plots or strategy orders. It does not run as a standalone program outside thinkorswim.

A reviewable scripting workflow

Start with a testable specification: define every input, formula, visual output, alert condition, and strategy rule. Generate the first source, then inspect names, offsets, defaults, and conditions before opening it in the platform editor.

After thinkorswim accepts the code, compare its output with a small set of bars you can calculate or inspect manually. This catches logic errors that a parser cannot detect.

  • Keep platform concepts such as study and strategy explicit.
  • Treat every default input as part of the script contract.
  • Record the symbol, aggregation, and session used for testing.

Pineify thinkScript workflow

Turn the specification into editable thinkScript

Give the Coding Agent the formula, inputs, plots, alerts, and edge cases. It returns one editable study or strategy file and keeps focused revisions in the same code artifact.

Open the thinkScript agent

Sources and scope

Last verified:

Pineify provides information and code-generation assistance, not investment advice. Generated scripts, strategy reports, simulations, and historical examples cannot predict prices or guarantee returns. Review every script and test it in thinkorswim before relying on its output.

Frequently asked questions

What language do thinkorswim scripts use?

thinkorswim scripts use thinkScript, a domain-specific language for chart calculations, studies, strategies, alerts, watchlist columns, and scan conditions.

Can a thinkScript strategy trade automatically?

The AddOrder function adds simulated orders to a strategy for analysis. It does not submit a live broker order. Keep live execution claims separate from chart strategy behavior.

Can Pineify edit an existing thinkorswim script?

Yes. Provide the current single-file study or strategy and describe the change. Review the revised source and verify it in the thinkScript Editor afterward.

Continue in the thinkScript coding workspace

Generate one editable thinkScript study or strategy, inspect the source, request focused changes, and complete the final check in thinkorswim.

Pineify generates source code. thinkorswim remains the platform authority for parsing and chart behavior.