How to Export ThinkOrSwim Chart Data to a CSV File
Learn three methods to export ThinkOrSwim chart data, scanner results, and custom study values to CSV files for backtesting, Excel analysis, and third-party tool integration.
- Why Export ThinkOrSwim Chart Data?
- Method 1: Export Scanner Results to CSV
- Method 2: Export Chart Data from ThinkOrSwim
- Method 3: Custom ThinkScript CSV Export
- Comparison of Export Methods
- Common Use Cases for Exported TOS Data
- Troubleshooting Common Export Issues
- Advanced Tips for ThinkOrSwim Data Export
- Related Tools and Resources
Why Export ThinkOrSwim Chart Data?
ThinkOrSwim stores a massive amount of market data, including price history, study values, and scanner results. Exporting this data to CSV files unlocks possibilities that the platform alone cannot provide. Traders use exported data for backtesting strategies in Excel, building custom analytics dashboards, and feeding data into third-party tools.
ThinkOrSwim's export capabilities fall into three categories: scanner exports, chart data exports, and custom ThinkScript-driven exports. Each method serves a different use case. Understanding when to use each approach saves significant time and produces cleaner datasets.
Method 1: Export Scanner Results to CSV
ThinkOrSwim's Stock Scanner tab is the fastest way to export filtered market data. The scanner lets you define custom queries using technical indicators, fundamentals, and options data. Once your scan runs, exporting the results takes just two clicks.
Step-by-Step Scanner Export
- Open the Scan tab in ThinkOrSwim from the top navigation bar.
- Build your scan criteria using filters like price range, volume, or technical indicators such as the Cumulative TICK or MACD.
- Click Scan to run the query and populate results.
- Right-click anywhere in the results table and select "Export to File" or use the menu icon in the top-right corner of the scan results panel.
- Choose your save location and filename. ThinkOrSwim saves the file as a
.csvby default.
The scanner export method works best for options traders and swing traders who need a snapshot of stocks meeting specific criteria. You can scan for options volume, implied volatility, or custom study values. The exported CSV opens directly in Excel, Google Sheets, or any data analysis tool.
Method 2: Export Chart Data from ThinkOrSwim
ThinkOrSwim allows direct export of price data (OHLCV) from any chart. This method captures historical candlestick data along with any studies applied to the chart. Chart data export is essential for traders who need raw price history for external backtesting.
Step-by-Step Chart Data Export
- Open a chart for the symbol you want to export in the Charts tab.
- Set your desired aggregation period (1-minute, 5-minute, daily, etc.).
- Right-click on the chart area and look for "Export chart data..." in the context menu.
- Select the studies and data columns you want included in the export.
- Choose your file destination and click Save.
ThinkOrSwim exports chart data with timestamps, open, high, low, close, and volume columns. Any studies plotted on the chart (moving averages, RSI, Bollinger Bands) appear as additional columns. This makes it straightforward to analyze indicator values alongside price action in a spreadsheet.
Method 3: Custom ThinkScript CSV Export
ThinkScript provides a built-in function called AddRow() that writes data directly to a file. This method offers the most control over what data gets exported and in what format. Custom ThinkScript exports are ideal for building automated data pipelines.
Basic ThinkScript Data Export
The following ThinkScript code exports daily OHLCV data to a CSV file. It creates a row for each bar on the chart with the date, open, high, low, close, and volume values separated by commas.
# Export OHLCV Data to CSV
# Apply this as a study on any chart
def dateValue = GetYYYYMMDD();
def timeValue = GetTime();
AddRow(
dateValue + "," +
open + "," +
high + "," +
low + "," +
close + "," +
volume
);
# Add a label to confirm the script is running
AddLabel(yes, "CSV Export Active", Color.GREEN);
Export Moving Average Crossover Signals
This advanced ThinkScript example exports moving average crossover signals with timestamps. Traders use this data to analyze signal accuracy in Excel or Python. The script flags each crossover event with a buy or sell label.
# Export Moving Average Crossover Signals
# Tracks 9 EMA and 21 EMA crossovers
input fastLength = 9;
input slowLength = 21;
def fastMA = ExpAverage(close, fastLength);
def slowMA = ExpAverage(close, slowLength);
def bullishCross = fastMA crosses above slowMA;
def bearishCross = fastMA crosses below slowMA;
def signal = if bullishCross then 1
else if bearishCross then -1
else 0;
# Only export rows where a crossover occurs
AddRow(
if signal != 0 then
GetYYYYMMDD() + "," +
(if signal == 1 then "BUY" else "SELL") + "," +
close + "," +
fastMA + "," +
slowMA + "," +
volume
else ""
);
AddLabel(yes,
"Crossovers Found: " + TotalSum(if signal != 0 then 1 else 0),
Color.CYAN);
After running this study, check the ThinkOrSwim Messages panel for the output rows. Copy the data into a spreadsheet for further analysis. This approach works well for validating strategy performance across different symbols and timeframes.
Comparison of Export Methods
ThinkOrSwim offers three distinct export approaches, each with different strengths. The table below compares these methods across key criteria to help you choose the right one for your workflow.
| Feature | Scanner Export | Chart Data Export | ThinkScript Custom |
|---|---|---|---|
| Output Format | Direct CSV file | Direct CSV file | Message log (manual copy) |
| Data Scope | Multiple symbols at once | Single symbol per export | Single symbol per chart |
| Custom Columns | Yes (study columns) | Yes (applied studies) | Full control via code |
| Historical Data | Current snapshot only | Full chart history | Full chart history |
| Automation Level | Manual trigger | Manual trigger | Runs on chart load |
| Best For | Screening & watchlists | Price history analysis | Signal-specific exports |
| Difficulty | Beginner | Beginner | Intermediate |
Common Use Cases for Exported TOS Data
Exported ThinkOrSwim data serves multiple analytical purposes beyond basic charting. Traders and analysts regularly export data for these specific workflows.
Backtesting in Excel or Google Sheets
ThinkOrSwim's built-in backtester has limitations on custom logic and reporting. Exporting OHLCV data with indicator values lets you build custom backtesting models in spreadsheets. You can test variations of strategies like the Opening Range Breakout across different parameters without re-running ThinkScript each time.
Building Custom Dashboards
Exported scanner data feeds directly into dashboard tools like Power BI, Tableau, or custom Python scripts. Traders who track supply and demand zones often export zone data to overlay with other datasets. This creates a unified view across multiple data sources that ThinkOrSwim alone cannot provide.
Options Analysis
Options traders export scan results containing implied volatility, Greeks, and open interest data. The scanner method works best for this use case because it captures a cross-sectional snapshot of the entire options chain. Exported options data integrates cleanly with pricing models built in Excel or Python.
Feeding Data Into Trading Platforms
Some traders export ThinkOrSwim watchlist data to import into other platforms like the ORB Setups platform. CSV files serve as a universal bridge between trading tools. This workflow is especially useful for traders who use ThinkOrSwim for scanning but execute trades on a different platform.
Troubleshooting Common Export Issues
ThinkOrSwim data exports occasionally produce unexpected results. These are the most common issues and their solutions.
Missing Data Columns
ThinkOrSwim only exports columns that are visible in the scanner results table or applied as studies on the chart. If expected data columns are missing from your CSV, verify that the relevant studies are added to the chart or scanner. For ThinkScript labels, note that label values do not appear in chart data exports.
Truncated Historical Data
ThinkOrSwim limits intraday data to approximately 180 days of history. Daily and weekly data extends back 20+ years for most symbols. If your export contains fewer bars than expected, check your aggregation period and the symbol's listing date. Switching to a higher timeframe increases the available history.
Formatting Issues in Excel
Excel sometimes misinterprets date and time columns in ThinkOrSwim CSV files. Dates may appear as numbers or in an unexpected format. To fix this, use Excel's Text Import Wizard instead of double-clicking the CSV file. Set date columns to "Text" format during import, then convert them manually after the data loads.
Large File Performance
Exporting charts with many studies applied can produce very large CSV files. ThinkOrSwim may slow down during the export process if dozens of studies are active. Remove unnecessary studies before exporting to reduce file size and speed up the process. A clean chart with only the needed indicators exports significantly faster.
Advanced Tips for ThinkOrSwim Data Export
Experienced ThinkOrSwim users employ several techniques to streamline the export process and improve data quality.
Batch Export with Watchlists
ThinkOrSwim's scanner allows you to restrict scans to specific watchlists. Create a custom watchlist with your target symbols, run a scan against that list, and export the results. This produces a single CSV containing data for all symbols in the watchlist. It is far more efficient than exporting chart data one symbol at a time.
Scheduled Scans for Recurring Exports
ThinkOrSwim scanners can be saved as presets and re-run daily with a single click. Traders who need daily exports build a scanner preset with all required columns, run it at the same time each day, and export the results. This creates a consistent time-series dataset over weeks and months without writing any code.
Related Tools and Resources
TOS Indicators provides several tools and guides that complement ThinkOrSwim data export workflows. Use these resources to build more effective scans and analyze your exported data.
- Opening Range Breakout Indicator — Export ORB levels and signals for external analysis
- Cumulative TICK Indicator — Track market internals and export tick data
- Moving Average Crossover Backtester — Test MA strategies with exported data
- Supply & Demand Edge — Export supply and demand zone data
- Aggregation Periods Guide — Understand timeframes for data exports
- ThinkScript Labels Guide — Add labels to your export scripts
- MACD Explained — Export MACD values and crossover signals
Ready to Trade With an Edge?
Join 40,000+ traders using institutional-grade tools for ThinkOrSwim.
Get the Bundle