This program allows you to auto export strategy reports from the TDAmeritrades Thinkorswim desktop platform.
This program has only been tested on Windows OS.
You will need the Thinkorswim desktop application, for the program is created for this application specifically. The program uses pyautogui to automate native keyboard and mouse functionalities.
Virtual Env: Pipenv [OPTIONAL]
Dependencies: pyautogui, playsound, keyboard
Desktop App: TDAmeritrades Thinkorswim
Language: Python 3.8+
- Go into your thinkscript editor for the strategy of your choice and plot a SMA or anything that will plot a line, and multiply it by 2 or more. (See image below)
- Once entered, apply and save.
- Once back at the main screen, go to your chart where you are displaying the strategy that you just added the SMA line to. Notice how high it is above the actual candles. Thats what we want. (See image below)
- Next, double click on the SMA line, and a customizing popup will display. Click on the plots dropdown, then click on the SMA tab. The image below is what should be displayed.
- Next, we need to change the draw as display, which changes how the plot is shown on the chart.
- We need to change this to a bar graph that covers the entire chart. (See image below)
- Click apply, and save.
- You should now have something like the image below.
-
There are key locations that you must obtain so the program knows where to send the cursor.
-
The images below will show the the locations.
-
There are two types of coordinates you will need. Relative and Absolute.
- Relative - x, y coordinates are relative to where your mouse cursor currently is located.
- Absolute - x, y coordinates are not relative to your mouse cursor and will go to the precise screen location specified.
-
All of these coordinates will need to be set in accordance to where they are needed in the program. The program has comments throughout to help you locate theses areas.
- First, you will need the absolute coordinates for the watchlist dropdown hamburger icon and relative coordinates for the Export to file... [Hamburger icon > Export to file... tab]
- In the file explorer that pops up after you click the Export to file..., get the relative coordinates for the save button. Make sure you change the directory to your working directory before saving. This will set the working directory as the default so you don't have to change it everytime.
- After that, you need the the absolute coordinates for the top most symbol in your watchlist. Always make sure that your watchlist is scrolled all the way to the top before you run the program, or you won't export all the files in the watchlist.
- Next, you will need absolute coordinates to any location within the red box below.
- This dropdown propegates when you right click on the chart only where the SMA graph is covering the chart. You will need the relative coordinates for the Show report tab.
- You will need the relative coordinates for the Export File button. [Show report tab > Export File button]
- You will need the relative coordinates for the Save button. All files will be downloaded to your documents folder by default. The program will automatically move each file from there to your csv_files directory in your working folder. [Export File button > Save button]
- Next, we need the relative coordinates for the Close button. [Save button > Close Button]
- Once closed, the program will automatically arrow down to the next symbol in the watchlist.
-
This process will continue until it reaches the final symbol in the watchlist.
-
Upon completion, an alert will sound letting you know that the program has finished. That way you can be away from your computer and you will hear when it's complete.
-
Well, the program can handle that. Just restart the program, and make sure that the watchlist is all the way to the top, and the program will automatically scroll down to where the program left off.
-
If there is an error, an alert sound will trigger, all remaining strategy reports located in the users documents folder will be deleted, and the error message will display in your terminal.
-
Most common error is when there is a missed export, due to either the user moving the mouse or Thinkorswim not loading charts fast enough, or not at all.