Thinkorswim AutoTrade Almost 204


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();

About Pete Hahn

For those trying to contact me about our professional services you will find all those details here: https://www.hahn-tech.com/about/ Any questions not related to our professional services or premium indicators should be directed to the comment section of the applicable video or you may post a question in our Q&A Forum: https://www.hahn-tech.com/thinkorswim-forum-topics/

Questions? Comments? Post a review?

204 thoughts on “Thinkorswim AutoTrade Almost

  • randy kreisel

    Pete, You are very talented and gracious in sharing your knowledge with us.

    I have had instances where I have had 2 conditions to a conditional order and they were not that big. When I saved the order and tried to use it again, TOS had truncated the condition to around 200 characters. Raised ticket with TSO and they confirmed there was a limit but not able/willing to share the details.

    Have you run into this issue and if so, how did you get around it?

    Keep up the excellent work.

    Randy

  • bruce macdonald

    Hi Mr Hahn. In reviewing the excellent video regarding the TOS almost auto trade set up I believe at 25:23 in the video the lower plot construction the way you describe it, appears to show entry signals and exit signals that were exactly opposite from what you show in your own set up at 25:33 or am I missing something?
    Best regards

    • Pete Hahn Post author

      You are correct. You are only the second person to notice this. The other person found it 10 months ago but posted their comment on the YouTube channel. Thanks for paying close attention to the details.

  • dennis mccabe

    i love this altho TOS is very limited on its workability of ATRtrailstop strategies i would love to see ATRtrailstop crossover alerts and a conditional order that executes at a specified time and triggers on reverse orders thru out the trading day at crossovers

    • Pete Hahn Post author

      You will need to move to another platform to achieve that. TradeStation is one. But the orders can only be submitted from a live chart. There is now way to store the conditional orders on the server, as we can with Thinkorswim.

      • dennis mccabe

        excellent, i really am interested in your work and this site has opened new and exciting doors for me, thank you sir, keep up the good work!!!!

      • Pete Hahn Post author

        Well for sure I will need to know where you found these expired URL’s. Certainly you did not find them in the comments section of this video. I can’t address the problem unless I know where you found these.

  • martin orellanes

    hello Hahn, excellent presentation in the video thank you for sharing it, but I have a doubt is it possible that the platform generates the real purchase and sale order in each signal of the strategy?

      • c0smik

        No better way to learn than from the firehose! Thanks for the reply, I did wonder if I was asking too early 🙂

        Could you help me with two more questions on TOS and automation? Is it possible to:

        -set up a sell rule that compares market price to a previous buy order?
        -set a sell rule that is triggered after a specific amount of time has elapsed from a buy order?

        Thanks again for your time and thoughts

      • Pete Hahn Post author

        So those two question each require the code to have the ability to read from the order book. This is not possible with Thinkorswim. The conditional order can only send an order to market based on the study parameters and rules contained within it.

  • Jay

    Hi Hahn,
    I have a quick question for you, I want to modify this strategy into buying when EMA 9 crossed above VWAP however when I go into condition wizard VWAP is under price and when I add VWAP on to the condition wizard chart it looks completely different than normal VWAP. There are no upper and lower bands and VWAP line is completely wrong so my strategy never comes out correct. what can i do to fix the vwap in condition wizard?

    Thank you for your time and any help

    • Pete Hahn Post author

      Well you cannot use the vwap that appears under the “price” category. You would need to use the one that appears under the “study” category. Not sure if it’s supported though.