Algo trading on Thinkorswim / process

Discussion in 'Automated Trading' started by fishindamarket, Jul 23, 2025 at 10:40 AM.

  1. I use TOS for my trading and looking to implement an automated strategy. Is TOS even able to run automated strategies/trades?
    I'm a total noob who doesn't know coding and trying to figure out how to even start. From my initial research it seems like the process would be :

    1. write the code
    2. find backtesting app and get market data API into it
    3. execution engine to automatically execute my trade through TOS when criteria is hit
    4. monitor trade and exit at set criteria

    This is obviously VERY basic, but without being familiar with API's, coding, etc it's hard to understand from reading posts and watching videos to figure out the process and what programs, API's, software to use.

    Appreciate any input or advice
     
  2. Bad_Badness

    Bad_Badness

    Separate out the coding part and the trading tasks, since you are not seasoned as a developer.

    • Select any trading design that is simple and easy, e.g. MA cross overs.
    • Try to code that up so that you can get your entries and exits
    • Get it to run on the platform.
    • Then add order handling, such as LMT versus MKT order, LMT to MKT, trade size, scaling,
    • Then test the error handling, such as disconnecting mid trade, and double orders, incomplete fills etc. (this is more about TOS)
    • Then add some simple risk management such as dynamic stops (stops that adjust based on how the trade is going.
    • Run it in back testing, and then in Sim. Compare the two results and figure out how to use the two. Back testing is good for testing the behavior too see if it is doing what it is supposed to do. It is not that good at determining actual profitability.

    Start with that. Once you get the non profitable strategy working, then plug in something you think might be profitable.

    Best of luck
     
    Last edited: Jul 23, 2025 at 12:01 PM
    sridhga likes this.
  3. 2rosy

    2rosy

    Write your strategy on paper with a pencil. Reread it a few times and ask if it makes sense and why. If so, get data and play with it and reread your strategy.
     
    Cam12 likes this.
  4. Zodiac4u

    Zodiac4u

    I use Tos as well, you can go into Tos and try their existing algo's and see how they perform. Afterwards you can click on the same algo on the list that you want to use and then right click and press edit and then you can familiarize yourself with their code language that's being used. But before you modify do a screen clip to keep a original copy and save it under a different name and now it's your algo to modify and play with. Tos can run the strategies but it gives you arrows to manually enter orders. No live self running algos. But there is a work around but its not allowed. :)
     
    zdreg likes this.
  5. If you want to start with that, don't go to trading strategies straight away; start by learning a programming language. APIs should be independent of the programming language if they are well done.

    So first, get familiar with a language that you like and learn the ropes.

    For trading, try not to go with dynamic languages; you want something that is strongly typed and can give you a robust syntax.

    Try this website with c# or c++.

    https://exercism.org/
     
  6. Sergio123

    Sergio123

    Pre-requisites: Select a timeseries database to store your data, and a Stochastic solver to optimize your P/L curve.

    1) Figure out the instruments, market(s), ticker(s) that you want to trade.

    2) Model the key parameters of the market(s) that you would like to trade from step#1.

    3) Generate X number of N length random samples using your model from step#2.

    4) Calculate key statistics from the random samples from step#3.

    5) Based upon the key statistics in step#4, Generate some strategies using the following logic: Buy S1 number of shares when price < P1 Sell S2 number of shares when price>P2.

    6) Re-Rerun Step #3 applying the strategy from Step#5.

    7) With the stochastic solver optimize variables S1,S2,P1,P2 such that the P/L curve matches your liking.

    8) Enter your optimized strategy order from step#7 into your broker's platform and only check up on it and optimize it every so often so that it isn't a distraction from your day job.