Thinkorswim AutoTrade Almost 198


As Close As We Can Get To Auto-Trading on Thinkorswim

In this video we show how to build your own code using a point and click condition wizard. The condition wizard

Thinkorswim AutoTrade Almost

Thinkorswim AutoTrade Almost

makes it very simple to build your own set of rules for trade execution. However you may not realize the code generated by the condition wizard can be very easily inserted into a template to form a Strategy and/or Custom Chart Study. We supply the templates, and show you how to put it all together. You will learn how to build your code using the condition wizard and you will learn how to convert that into a Strategy file. And Using tools we provided in previous videos you will then be able to analyze the performance of those Strategies.

We also show you how to use the condition wizard to generate orders that will execute in the same way as those theoretical orders generated by the custom Strategies.
 
AutoTrades are not fully supported on Thinkorswim as on other platforms. However if you learn how to connect the pieces you can place conditional orders that await the signal created by a set of defined rules. Once the conditions are satisfied, the order is released from hold and becomes a live order.

DISCLAIMER: I AM NOT A CERTIFIED FINANCIAL ADVISOR AND NOTHING IN THIS VIDEO OR TEXT IS AN ADVERTISEMENT OR RECOMMENDATION TO BUY OR SELL ANY FINANCIAL INSTRUMENT. NOR IS THIS VIDEO OR TEXT INTENDED TO INSTRUCT YOU ON HOW TO MAKE BUY OR SELL DECISIONS USING ANY OF THESE INDICATORS.

*Thinkorswim is a chart analysis platform offered by TD Ameritradewww.tdameritrade.com

TD Ameritrade provides financial services including the trading of Stocks, Futures, Options and Forex.

 

Please be sure to share this page with your friends and colleagues. Leaving comments below is the best way to help make the content of this site even better.

Watch the video, Thinkorswim AutoTrade Almost below:

 

This is the code for the Strategy Template:
input tradeSize = 100;
def signal = 0;
addOrder(OrderType.BUY_TO_OPEN, signal, open[-1], tradeSize, Color.CYAN, Color.CYAN);
def exit = 0;
addOrder(OrderType.SELL_TO_CLOSE, exit, open[-1], tradeSize, Color.MAGENTA, Color.MAGENTA);

This is the code for the Study Template:
declare lower;
plot signal = 0;
plot exit = 0;

This is the code for the revised SLM Ribbons study:
input price = close;
input superfast_length = 8;
input fast_length = 13;
input slow_length = 21;
input displace = 0;
def mov_avg8 = ExpAverage(price[-displace], superfast_length);
def mov_avg13 = ExpAverage(price[-displace], fast_length);
def mov_avg21 = ExpAverage(price[-displace], slow_length);
#moving averages
Plot Superfast = mov_avg8;
plot Fast = mov_avg13;
plot Slow = mov_avg21;
def buy = mov_avg8 > mov_avg13 and mov_avg13 > mov_avg21 and low > mov_avg8;
def stopbuy = mov_avg8 <= mov_avg13;
def buynow = !buy[1] and buy;
plot Buy_Signal = buynow and !stopBuy;
Buy_signal.setpaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
Buy_signal.setdefaultColor(color.dark_GREEN);
Buy_signal.hidetitle();
def sell = mov_avg8 < mov_avg13 and mov_avg13 < mov_avg21 and high < mov_avg8;
def stopsell = mov_avg8 >= mov_avg13;
def sellnow = !sell[1] and sell;
Plot Sell_Signal = sellNow and !stopSell;
Sell_signal.setpaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_down);
sell_signal.setDefaultColor(color.red);
Sell_signal.hidetitle();

__ Support our free content by making a purchase below. Thanks! __

Questions? Comments? Post a review?

198 thoughts on “Thinkorswim AutoTrade Almost

  • T

    Hello Pete. Thanks so much for posting all of your tutorials, very helpful! Question: How do you get your orders to continue in wait condition after they have been fired/executed? For example, once my buy order is executed/filled it disappears (same with sell order). How do I get the orders to continue to stay in wait condition mode so that when the buy order condition is met again, the order will be filled and same for sell order.

    One other note — Someone will want to wait to make sure the buy order is filed first if they are intending a long side sequence. If the sell order is filled first, the sequence would be inversed to a short order sequence. Does that make sense and I stated that clearly?

    Thanks in advance!

    • Pete Hahn Post author

      The short answer is simple. You don’t. That’s exactly why the word “Almost” is included in the title of this video. Pretty sure I explained this in the video too. And that should answer part two of your question as well. It’s largely a manual process. We have very limited automation features in Thinkorswim.

      • T

        Thanks for your fast response Pete!! I apologize, I knew you said it was almost but I guess I missed the part where the orders would not persist. I did think it was very cleaver to embed code into the orders to make them a little “smarter”. Question — Have you considered or looked into using the TDAmeritrade developer’s APIs to have the orders continue to be placed? I was directed to the by TDAmeritrade and am beginning to study it but not sure if it will handle the part that is missing for automation. I see that some folks out there are selling automated products for ThinkorSwim, so I am hopeful. Again, thank you for all your hard work and sharing all of your knowledge. I would not have made the progress I have made without you and your work!

      • Pete Hahn Post author

        The very best answer I have for this question. Why go through the trouble of modifying a Corvette to plow your fields when you can simply use a tractor? In this analogy, Thinkorswim is the Corvette. If you want a fully automated trading system the answer is very simple. Move to a trading platform that supports this functionality right out of the box. The list of such trading platforms is very broad.

      • T

        Thanks Pete! I have always liked ThinkorSwim, but I understand what you are saying. Are there any ones you would recommend? Again, thanks so much!!

      • Pete Hahn Post author

        I have created fully automated trading systems in Sierra Chart and TradeStation. I believe that TradeStation provides a more flexible and robust trading platform than Sierra Chart.

  • Tim

    Hi Pete. Just watched this last night…very informative. Thank you for sharing. Is there a way to change the time interval and aggregation period in the chart that is displayed in the condition wizard? I would like to see it at the 5 minute level, not the day level and have not been able to figure out how to change it in the condition wizard. Thanks in advance.