Thinkorswim
Your thinkScript Strategy Can't Leave ThinkorSwim — Here's the Bridge
A thinkScript strategy is a backtest drawn on a chart. It cannot place a live order, send a webhook, or call an outside service — Schwab's own documentation says so. Here are the three ways out, with the same 10/30 crossover written in thinkScript and in Python.
Educational content, not investment advice. Trading involves risk of loss.
In brief
- thinkScript strategies only simulate orders — Schwab's own reference says the signals are hypothetical and cannot send real orders.
- thinkorswim has no external API or webhook; the Schwab Trader API is a separate product with a 7-day refresh token and stocks, options, and ETFs only.
- The same 10/30 moving-average crossover, written in thinkScript and mirrored in Python, ran 8 round trips on 500 synthetic bars: +1.81%, max drawdown 2.45%.
- The honest bridge is re-implementing the logic where orders can be placed — or handing the build to an embedded engineer.
On this page
The short answer
Your thinkScript strategy will never place a live order. Not because you wrote it wrong — because that is not what a thinkScript strategy is. Schwab's own thinkScript reference says it plainly: "all the signals you get are hypothetical, i.e., you cannot send real orders using strategies." A strategy in thinkorswim is a backtest drawn on a chart, with a performance report. If you want the same rules trading real money, the logic has to leave the platform — and thinkorswim gives it no door out. There is no external API, no webhook, and no signal export. What exists instead is a separate Schwab developer product with its own limits, or a re-implementation of your rules where orders can actually be placed. This guide shows the same 10/30 moving-average crossover in thinkScript and in Python, runs the Python version so you can see real numbers, and ranks the three exits honestly.
What thinkScript actually automates — and what it doesn't
thinkScript is the scripting language built into thinkorswim, the desktop platform Charles Schwab inherited from TD Ameritrade. It automates three things well: custom studies that plot whatever you can define, alerts that fire when a condition is true, and strategies that simulate entries and exits on historical bars and produce a strategy report. The strategy side is where the confusion lives. You write a strategy with AddOrder, the function that turns an indicator into a simulated trading system. The reference documents its full form as AddOrder(type, condition, price, tradeSize, tickColor, arrowColor, name), and the default fill price is the open of the following bar — the order is added to the next bar after the condition is fulfilled, not the bar that produced the signal. That is an honest backtest convention. It is also the whole story: the arrows on your chart are hypothetical trades, and the report is a hypothetical P&L.
The rest of the platform stays inside too: alerts deliver by sound, email, SMS, or mobile push — no webhook, no outbound HTTP — and conditional orders execute inside thinkorswim's own order entry system. As TradersPost put it in its November 16, 2026 survey: "Every one of these tools operates entirely within thinkorswim... Nothing comes out."
Exit 1: the Schwab Trader API — real, but narrow
The closest thing to an exit is not part of thinkorswim at all. The Schwab Trader API is a separate developer product, built after Schwab acquired TD Ameritrade, with its own registration and its own approval process — a developer account first, then a separate access request for the Trader API, each going through pending review. The old TD Ameritrade developer portal has permanently disabled new user registration, and existing legacy applications were not automatically migrated; developers had to re-register and integrate against new endpoints.
Even once you are in, the API is narrower than most traders assume. Order placement covers stocks, options, and ETFs only — futures, futures options, and forex order entry are explicitly excluded, so a strategy trading ES futures or any forex pair cannot place orders through it at any tier. And the Individual tier carries a structural constraint that breaks fully unattended automation: the refresh token expires after seven days, so the application cannot obtain new access tokens without a manual sign-in by the account holder. A system running without human intervention fails after seven days unless someone builds a re-authentication workflow that includes explicit user interaction. That is a design constraint of the token lifecycle, not a misconfiguration. If your strategy trades equities or options, you are comfortable with OAuth flows and REST APIs, and you accept a weekly manual sign-in, this exit works. If your strategy trades futures or forex, or must run unattended for months, it does not — and no tier changes that.
Exit 2: re-implement the logic where orders live
The exit most systematic traders actually take is the boring one: take the rules out of thinkScript and re-implement them where orders can be placed. The rules are usually short — a crossover, a filter, a position size — and the translation is mechanical, as the next section shows. TradingView has the same go-live gap, covered in the Pine Script v6 strategy guide and Pine Script alerts versus real automation, and the fix is the same: the strategy has to live where the broker connection lives. QuantIDE runs the same logic live on any broker. The full loop is laid out in automating a trading strategy end to end, and the broker-connection half in connecting Python to your broker's API, including the Interactive Brokers example at QuantIDE for Interactive Brokers. There is no /for/thinkorswim page, because there is no broker connection to build on — the platform will not hand the signal over.
The same strategy, twice
Here is a 10/30 moving-average crossover as a thinkScript strategy, following the reference's own pattern. It buys when the fast average crosses above the slow one and sells when it crosses back below, filled at the next bar's open, 100 shares a trade:
input fastLength = 10;
input slowLength = 30;
input shares = 100;
def fastMA = Average(close, fastLength);
def slowMA = Average(close, slowLength);
AddOrder(OrderType.BUY_TO_OPEN, fastMA crosses above slowMA, open[-1], shares, Color.GREEN, Color.GREEN, "Long");
AddOrder(OrderType.SELL_TO_CLOSE, fastMA crosses below slowMA, open[-1], shares, Color.RED, Color.RED, "Exit");
BUY_TO_OPEN and SELL_TO_CLOSE are the order types that only open or only close a position — the reference notes they exist alongside BUY_AUTO and SELL_AUTO, which both open new positions and close previous ones. open[-1] is the next bar's open, the same default fill the reference uses in its own example. The same rules in Python, executed on 500 synthetic daily bars (seed 42, starting equity $100,000, 100 shares per trade, fills at the next bar's open):
def sma(values, n, i):
return sum(values[i - n + 1:i + 1]) / n
for i in range(30, 499):
fast, slow = sma(closes, 10, i), sma(closes, 30, i)
prev_fast, prev_slow = sma(closes, 10, i - 1), sma(closes, 30, i - 1)
if prev_fast <= prev_slow and fast > slow and not in_position:
buy_at(opens[i + 1], 100) # next bar's open
elif prev_fast >= prev_slow and fast < slow and in_position:
sell_at(opens[i + 1], 100)
The run produced 8 round trips — 4 winners, 4 losers — ending at $101,813.93, a 1.81% gain with a 2.45% maximum drawdown. The first buy fired on bar 56 at 99.18. Read those numbers for what they are: a synthetic-data illustration that the translation works, not a performance claim. A 10/30 trend system on a random walk should not be expected to make money, and on this run it barely did. What matters is that the logic, the fill rule, and the position size are identical in both versions — the strategy is portable, the platform is not.
The execution details that change the answer
Three details decide whether the moved strategy behaves like the one on your chart. First, the fill: thinkScript strategies fill at the next bar's open by default, so a Python version that fills at the signal bar's close is testing a different strategy — one that trades on information it could not have had. Second, the order type: BUY_AUTO reverses a position automatically, which is not the same as a long-only system with explicit exits; use BUY_TO_OPEN and SELL_TO_CLOSE when that is what you mean. Third, the loop: a live system needs the parts thinkorswim never shows — a broker connection, a fill check, a kill switch, and monitoring for the day the connection drops. A backtest report answers whether the rules made money on history. It says nothing about whether the system will keep running on a Tuesday.
What to do next
If your strategy trades stocks, options, or ETFs and you are happy maintaining OAuth tokens and a weekly sign-in, apply for the Schwab Trader API and build the bridge yourself — just budget the token renewal from day one. If it trades futures or forex, or it has to run unattended, skip that exit: re-implement the rules in Python against a broker API, or hand the build to an engineer. That last option is the embedded-engineer model — the same desk BlackShore Agency runs for operating businesses that want systems built, not just explained: describe the strategy, it comes back built and running live on your broker. Either way, stop waiting for thinkorswim to grow an exit. The platform's own documentation has already told you it will not. Download QuantIDE and move the strategy to where the orders are.
Frequently asked questions
Can a thinkScript strategy place live orders?
No. Schwab's thinkScript reference states that strategy signals are hypothetical and cannot send real orders. A thinkScript strategy backtests on a chart and produces a performance report; live orders require the logic to run outside thinkorswim.
Is there a thinkorswim API?
No. Schwab documents no external API for thinkorswim — no webhook, no signal export. The closest option is the Schwab Trader API, a separate developer product with its own registration, and it is not accessible from within thinkorswim.
What does the Schwab Trader API not cover?
Order placement is limited to stocks, options, and ETFs. Futures, futures options, and forex order entry are explicitly excluded at every tier. Its Individual-tier refresh token also expires after seven days, requiring a manual sign-in to restore access.
Sources
Related reading
- GuideAutomating a Trading Strategy End to End: From Signal to Live OrdersAutomating a strategy is five stages, not one: signal, sizing, order, execution, monitoring. Most people automate two of them. Here is the full loop, with code you can run.5 min read
- GuidePython Just Arrived in cTrader — Your First cBot in an AfternoonPython developers no longer need C# to automate on cTrader. A complete first cBot — a 10/30 crossover — its logic run on 500 synthetic bars, and the four gaps between a passing backtest and a live system.4 min read
- GuideYour First NinjaTrader Strategy: From AI Strategy Builder to a Live Futures SystemNinjaTrader 8.1.9 shipped the AI Strategy Builder out of beta on November 10, 2026: plain English in, compiled NinjaScript and an instant backtest out. A backtest is not a live system — here is what it proves and the four gaps to live orders.5 min read
- GuideMetaTrader 4 vs MetaTrader 5: Which One Should You Automate On?MT5 is the right default for anything new — more timeframes, real-tick multi-currency testing, and netting accounts. MT4 still wins only when your broker or your Expert Advisor lives there. The deciding difference is position accounting, and it changes how your strategy behaves.6 min read