Auto Place Buy And Sell Orders In ThinkOrSwim

Hi
I looking for auto buy and sell my whole watchlist in my set condition ? Is that possible?
thank
 
It's great to be able to backtest with order entry ... however now I want to front test.
I'm interested in both simulated and real money trading live with my strategy.
The only problem is, I don't know how to enter real orders using thinkscript.
Does anyone know if there is a way?
 
ToS does not offer automated trading other than conditional orders. You can search around here for further discussions of approaches to conditional orders.

-mashume
 
The ToS platform does not support "fully automated orders".

The ToS Conditional Orders Widget is able to set up trades using SIMPLE filters.
Create your regular order: buy 100 shares of ABC stock but add a condition such as: do not fill until 5EMA crosses 9EMA.
Conditional Orders are one and done. They are added to the regular order that is manually created and once filled, they are done.

https://tlc.thinkorswim.com/center/howToTos/thinkManual/Trade/Order-Entry-Tools/Order-Types/thinkScript-in-Conditional-Orders#:~:text=In thinkorswim, orders can be,for placing and canceling orders.

https://tlc.thinkorswim.com/center/howToTos/thinkManual/Trade/Order-Entry-Tools/Order-Types

https://tickertape.tdameritrade.com/trading/trading-basics-advanced-stock-order-types-17852
 
Last edited:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#

input ConsecutiveBarsDown = 3;
input price = close;

def bars_down = if price < price[1] then bars_down[1] + 1 else 0;
addOrder(OrderType.SELL_AUTO, bars_down >= ConsecutiveBarsDown, tickColor = GetColor(1), arrowColor = GetColor(1));



This Is The Other One

#
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#

input ConsecutiveBarsUp = 3;
input price = close;

def bars_up = if price > price[1] then bars_up[1] + 1 else 0;
addOrder(OrderType.BUY_AUTO, bars_up >= ConsecutiveBarsUp, tickColor = GetColor(2), arrowColor = GetColor(2));

Thanks.
 
The ToS platform does not support auto trading.
These strategies do not actually buy and sell shares.
Strategies on the ToS platform are for backtesting purposes only; to provide information of how the indicator would perform if you actually manually placed the orders.

If you don't want to see the simulated buy/sells then copy and paste the following into the STUDIES tab (not strategies).
Ruby:
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#

input ConsecutiveBarsDown = 3;
input price = close;

def bars_down = if price < price[1] then bars_down[1] + 1 else 0;


plot sellarrow = bars_down >= ConsecutiveBarsDown;
     sellarrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

input ConsecutiveBarsUp = 3;

def bars_up = if price > price[1] then bars_up[1] + 1 else 0;
plot buyarrow = bars_up >= ConsecutiveBarsUp;
     buyarrow.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_UP);
 
Last edited:
in auto trading, how would you enter the stock symbol? I have not done it before. how would the system knows what stock to buy when the condition met?
 
Last edited by a moderator:
in auto trading, how would you enter the stock symbol? I have not done it before. how would the system knows what stock to buy when the condition met?
The ToS platform does not support auto trading. The AddOrder function is used for backtesting theoretical trades.
There is not a way to turn theoretical trades into real trades.
 
Hello,

I am trying to create an automation button that will create buy or sell on the current market price on the current active candle for 1 contract as default. Anyone knows how can add the script and create the button to speed up the process creation buying or selling?

Thank you
 
Hello,

I am trying to create an automation button that will create buy or sell on the current market price on the current active candle for 1 contract as default. Anyone knows how can add the script and create the button to speed up the process creation buying or selling?

Thank you
No, ToS does not offer automation to that level.
The ToS platform provides some hot keys for some functions.
https://tlc.thinkorswim.com/center/howToTos/thinkManual/Getting-Started/Keyboard-Shortcuts

An interesting discussion going on is the idea of create keyboard macros. Here is one example:
https://usethinkscript.com/threads/moving-average-master-strategy-for-thinkorswim.13975/#post-116132
More "Macro Recorder" posts:
https://usethinkscript.com/search/1051285/?q="Macro+Recorder"&t=post&o=date
 
Hi
This strategy that I want to Buy and Sell
Can you help me to add one more condition , Buy when MACD Histogram cross above zero "or" EMA 5 Cross Above EMA 8
Sell when MACD Histogram at Diff positive and Down "or" EMA 5 Cross Below EMA 8

Many Thank

This is what I wrote by my own it is only in one condition

def buyLong = MovAvgExponential("length" = 5)."AvgExp" crosses above MovAvgExponential("length" = 13)."AvgExp";

def sellLong = MovAvgExponential("length" = 5)."AvgExp" crosses below MovAvgExponential("length" = 13)."AvgExp";

Addorder(ordertype.Buy_to_Open, buyLong, tickcolor = Color.blue, arrowColor = Color.Blue, name = "open");
Addorder(ordertype.Sell_to_Close, sellLong, tickcolor = Color.orange, arrowColor = Color.orange, name = "close");
 
New to TOS. I wrote a strategy to backtest that I'm happy with but it contains many conditions and multiple buy/sell signals. I would like to implement as an automated or semi-automated trading bot. I've looked into the Study Order Condition using Thinkscript but it seems like that is more for one-two liners maybe? Is there another better option that I have not considered? Should/Can I create plot signals from a custom study that can be used to trigger the trades?

Thank you in advance.
 
New to TOS. I wrote a strategy to backtest that I'm happy with but it contains many conditions and multiple buy/sell signals. I would like to implement as an automated or semi-automated trading bot. I've looked into the Study Order Condition using Thinkscript but it seems like that is more for one-two liners maybe? Is there another better option that I have not considered? Should/Can I create plot signals from a custom study that can be used to trigger the trades?

Thank you in advance.
You are correct. The ToS app limits the number of lines that you can stuff into the condition wizard.
Yes, you can create a custom script to contain your filters.

ToS platform does not support automated trading. And conditional orders will do little to further your automated quest. Conditional orders are once and done, and they are not saved.
You still need to create the conditional order from scratch for every trade.

Here are the steps and the limitations of creating conditional orders:
https://usethinkscript.com/threads/answers-to-commonly-asked-questions.6006/#post-80482
 
Last edited:
How do we convert this code
https://usethinkscript.com/threads/looking-for-a-support-resistance-strategy.15429/
to auto place buy to open and sell to close orders?
The ToS platform allows you to backtest your strategies and review hypothetical results.
But the platform doesn't support automatic buy and sell orders.
Yes, you can test your strategies and analyze their performance, however executing trades will require manual input from you.

The thread that you referenced is still under discussion.
It currently only contains one indicator; so it would not make a good backtesting candidate.
Research has shown that no stand-alone indicator can consistently perform well across all instruments, timeframes, and market conditions.

Read more:
https://usethinkscript.com/threads/backtesting-a-tos-strategy.10942/#post-124609
 
Last edited:
I'm thinking of coding an algo which scans the market, adds specific stocks, then trades those stocks from the scan.
Is it possible to code the strategy directly on Thinkscript?

The basic idea:
Scan NASDAQ for stocks below $5, above 100,000 volume, over 20% price change from previous day close
Select top three stocks from scan
Apply buy and sell conditions to those three stocks
 
@jakin000000
Your filters can be created in the scan hacker.
You can then create another scan to further filter those scan results by whatever is your definition of "top results".
But that is as far as you can go, "automatically"
 
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
234 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top