Thinkorswim AutoTrade Almost 24


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! __

Comments Drive Content of Future Posts:

24 thoughts on “Thinkorswim AutoTrade Almost

  • 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.

  • Troy.B

    Hi Mr Hahn, Thank you for all that you have done for us little guys. Please forgive me if im posting in the wrong section .
    Have you ever seen this indicator before? ( https://twitter.com/wetalktrade?lang=en ) its called pip breaker and is used for forex trading only. would you be able to build an indicator similar to this one for the thinkorswim platform?
    Thanks for your time.

    • Pete Hahn Post author

      Reverse engineering other indicators without source code. Not what we do here. If you have source code or the exact specifications for how the indicator functions we can work with that. The indicator must be open source and free of copyright.

  • Bennett Williford

    Is there a way on ThinkorSwim when you create the orders based on the conditions in the study to automatically renew when their conditions are met for the first time? Every time my orders are filled, the conditional order goes away. This doesn’t allow for my strategy to continue to autotrade over and over. It only allows for an autotrade one time based on that condition. After that I would have to manually input the conditional order.

  • Evelina

    Pete, do you happened to know what trading platform allows conditional order with secondary aggregation (to implement your MTF MACD) or what trading platform has automated trading ?
    zillions thanks for your always super useful posts

  • Mark Baker

    I love this concept, it has incredible potential. But like you say in the video it would be very dangerous to use this without extensive testing. Here is my problem, when I am using paper money TOS will not allow me to use the study filters. It says that I don’t have permission. I contacted one of the TOS tech’s on the chat and he says that study filters are not available in paper money. I find this hard to believe because I saw you using study filters with paper money in the video. What am I missing? …I don’t really want to do testing on my live account.

    • Pete Hahn Post author

      My reply via email is copied below for the benefit of other viewers:
      In the video I make use of the Study Filter for some examples but most of the work is done in the Condition Wizard tied to an order. Make sure you are no confusing the two. Because as you say the Study Filter is not available in PaperMoney. So when you see me logged into PaperMoney, I am modifying an order, using the Condition Wizard.

      To sum things up. There is no reason to use PaperMoney to build alerts using the Study Alert. Because the Study Alert has nothing to do with order execution. Make sure you understand there are two completely different tools here. The Study Alert can be used to do initial testing. Then move to PaperMoney and enter orders, applying that same code to the Condition of each order.

  • Scott Blomenkamp

    Great video, I am trying to apply your technique using the pricechannel study and am having a issue. I am trying to use the upperband to trigger the buy and the lower to trigger the exit. The study part shows shows what appears to be the correct triggers. However the stratedy code seems to apply both to the upper band.

    declare lower;

    plot signal = high crosses above PriceChannel().”UpperBand”;

    plot exit = low crosses below PriceChannel().”LowerBand”;

    ################################################

    input tradeSize = 100;

    def signal = high crosses above PriceChannel().”UpperBand”;
    addOrder(OrderType.BUY_TO_OPEN, signal, open[-1], tradeSize, color.CYAN, Color.CYAN);

    def exit = low crosses below PriceChannel().”LowerBand”;
    addOrder(OrderType.SELL_TO_CLOSE, signal, open[-1], tradeSize, color.MAGENTA, Color.MAGENTA);

  • Hilario Dsouza

    Hi Pete,
    Thanks for the video and the code.
    I copied the code (from the strategy template) and pasted it into a new study on a 2 min time chart for /TF, but I do not see any orders show up on the chart, like in your video. I have tried various things and they refuse to show. I even opened TOS from a different computer :). Any ideas

    Thanks
    Hilario

  • Terry C

    Hi Pete,
    I have been studying your recent youtube “Thinkorswim AutoTrade Almost” video.
    It has been very educational!
    Thanks for distilling the process down so elegantly.
    I have been attempting to set up a conditional order through the wizard that applies to Options on ETF’s that I track on a 10 tick Renko Bar chart.
    I see that in the wizard, the only chart options are from 1 minute to 1 month. There are no tick options nor any way to identify a specific type of bar (i.e. Renko 10 ticks).
    Do you know of any way to set up a conditional order with the chart criteria I mentioned?
    Your assistance is greatly appreciated.
    Terry

    • Pete Hahn Post author

      Hi Terry,
      Thanks for the feedback. At this time there are no options for Tick, Range or Renko charts using conditional orders, scans, or study alerts. Be sure to submit this to support@thinkorswim as a feature request. If enough folks request this they are likely to add this in a future release.
      Take care, good luck in your trading.