How to Export and Process ThinkorSwim Backtesting Data


2019 Donor
I wanted to share with everyone how I have attempted to tackle the abysmal backtesting platform in ThinkorSwim using Excel.

You will need some pre-requisites to get started
  1. Notepad++: I use this tool for removing the commas from the thousands separator in the P/L column. It is also great for handling multiple files all at once.
  2. Excel: I was going to do this with Google sheets but it became more of a burden and I lost interest
  3. File Repository:
The video below will take you through all the steps to utilize the backtest sheets properly. If you don't have time for the video the instructions are in the file repository and the Backtest template, Ill also paste them below the video.

Backtesting How-To

Open the Backtest DB ( here you can store the results of all your backtests it also stores the macro you will use to normalize the think or swim backtest CSV's)

Exporting your Strategy Backtest

  1. Run a backtest
  2. Right-click on a signal of your backtest
  3. Select show report
  4. Click export file
  5. Save the file to your computer
On your computer
  1. Rightclick on the CSV file you saved and select open with Notepad++
  2. Hit ctrl+F to open the find window
  3. Select replace
  4. In the find what dialog box add a comma (we want to remove all the extra commas)
  5. Select replace all in all open documents
  6. Select save
  7. Close notepad++
Open the BackTestTemplate_Equities.xlsx file and minimize

Open your backtest file from TOS
  1. All the data is in column A so we will use the Macro from the DB sheet to scrub
  2. Use ctrl+f the macro in the database excel file will expand all the relevant columns
  3. Now you can copy and paste the columns into the Raw data column in the template
  4. Copy your data in the Raw Data tab
Select the raw sort tab
  1. Paste your data in the RawSort tab
  2. Sort the data on the Date/Time Tab
Select the stats tab to pull out the relevant stats for your strategy. The Results tab also has some relevant charts for P/L Distribution and your P/L Curve
Last edited by a moderator:
As @Zachc noted above, ALWAYS use Notepad++ for storing Thinkscript as well. Never WORD or other word processor. Thanks, Zachc!
Has anyone figured out the SQN formula "=SQRT(D3*D12)/(STDEV.P('Raw Data'!G:G))" on the stat sheet? It never gives a good number.
Has anyone figured out the SQN formula "=SQRT(D3*D12)/(STDEV.P('Raw Data'!G:G))" on the stat sheet? It never gives a good number.
Members were not able to answer your question. You will need to ask ToS Support.
Please come back and let us know what they said.

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
585 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.