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
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 Ameritrade: www.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();
How do you plot the buy and sell signals for the SLM ribbon in a lower study on the charts?
https://www.hahn-tech.com/thinkorswim-scan-slm-ribbons/
I have been watching the videos on your site and have learnt so much over the last few weeks. I was hoping to get your recommendations on some of the top platforms that support full automation of a strategy. Thanks.
I have experience with only two platforms that support fully automated trading. So I can not provide a recommendation.
Can you share those two platforms?
Of the two I have worked with in the past I can only recommend TradeStation. Not because it’s better than the others, but because it’s the only viable trading platform that supports fully automated trading AND for which I have experience using and building automated trading systems.
Thank you so much sir!!!!!!
Hi. I’d want to ask you if it’s possible to do a script that follows last price of a stock, compare it to last prices and, according to the difference between the last price and the previous ones, following them second by second, sends buy and sell orders. Once it sells the stocks, it starts looking again the moment for buying and so on. Thank you very much.
What you have just described is a fully automated trading system and I made it perfectly clear in this video that fully automated trading systems are not supported in Thinkorswim.
Hi, why in the code it was choosen “open [-1]” why the -1?
The answer is very complicated to explain. See my answer in the following post of our Q&A forum for the explanation: https://www.hahn-tech.com/ans/parablic-sar-signal-not-firing-in-tos-strategy/
Thanks a lot Pete it was a great video, i create some code with macd but when i enter the order to Sell, it appear a message that saids: “Entering this order will cancel your open working orders” and cancel the buy order…, is there is any solutions for this?
You cannot create the order to sell until the buy order has filled.
Hi Pete. Thanks for all the content on here. I setup my left column for the ttm squeeze and have it on different time frames on tos. lights up red when theres a squeeze…. Is there any way to set it to ticks?
At this time Tick based time frames are only supported for charts in Thinkorswim.
Can a scanner script be written for Ichimoku signals? Price action above Clouds, lagging indicator above price action, averages cross & future cloud green? & or the inverse for shorts?
Did you use the side menu at the left to browse the contents of the scans category? https://www.hahn-tech.com/thinkorswim-scan-ichimoku/
Sry, I am learning to navigate this site. Thanks for your help!!
Thanks for your detailed explanations and this is really helpful!! I do have a question in regards with triggering orders based on Study Condition.
I am trying to create a Study order (BUY) which basically using the HullMoving average
input price = close;
input length = 8;
input displace = 2;
def HMA = MovingAverage(AverageType.HULL, price, length)[-displace];
def hmaAscending = HMA > HMA[1] and HMA[1] > HMA[2];
plot trigger = (hmaAscending and !hmaAscending[1]);
This code perfectly shows/plots in the conditional wizard window in the Alert lower section. But when I save it and go Put this into a order it does not buy even though it should according to the script. I’m trying to buy when the HULL changes the color only on a uptrend.
Can you please help?
Thanks
Addressing issue like this in the comments section of a video is not possible. I suggest you take the time to search the strategy guide topic of our Q&A forum for guidance.
Thanks Pete for your response.
I am trying to create a BUY and SELL using HullMovingAvg. Convert it to a Conditional Wizard code as it looks like doesnt like the above complex code for the Conditional Wizard.
Best place to find solutions is in the Q&A forum on this site.