Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

5/20/2020 Is it possible to write a ThinkScript script to make time-based buy/sell orders?

: thinkorswim

Search

 5   Is it poss… CLOSE

Posted by u/TheFlyingBoat 10 days ago

Is it possible to write a ThinkScript script to make


time-based buy/sell orders?
I am trying to write a script to automatically buy and sell at arbitrary
times throughout the day at market price to test out a hypothesis.
Ideally I want to be able to have this script run everyday for a year
without intervention. Can anyone point me to guidance on how to write
a script to buy and sell individual tickers at an arbitrary time every day?
I can seem to write complicated scripted strategies without too much
ease with the help of their documentation but can't seem to find a way
to let me do something this simple. Does anyone have any
suggestions? Thanks in advance for any help you can offer.

 3 Comments  Share  100% Upvoted

Log in or sign up to leave a


LOG IN SIGN UP
comment

SORT BY BEST

ViennaMora 1 point · 10 days ago


The beginning script for this is
AddOrder(OrderType.BUY_TO_open,

After that you can define other variables for specific times and
amounts you want to buy.

Starting out i would load up other prebuilt strategies already


available in tos to see how they worked and just
copy/paste/modify on the fly

johntwit 1 point · 10 days ago · edited 10 days ago


There is a random function which returns a random integer.

https://tlc.thinkorswim.com/center/reference/thinkScript/Funct
ions/Math---Trig/Random

https://www.reddit.com/r/thinkorswim/comments/ggwr50/is_it_possible_to_write_a_thinkscript_script_to/ 1/9
5/20/2020 Is it possible to write a ThinkScript script to make time-based buy/sell orders? : thinkorswim

Search It returns a random value between 0 and 1. You could adjust


the probability of buying like this, in this example the default
probability is 50%:

VIEW ENTIRE DISCUSSION ( 3 COMMENTS)

More posts from the thinkorswim community

Posted by u/lenny_parisi 5 days ago

How do you see the price of an option in relation to the stock's


price in TOS?
For example, say stock A is at $15 and my option is worth $1. I want to set a
stop loss for my option so that I sell when the stock is at $13. I don't know
what the price of the option is going to be when the stock is at $13; is there a
way to get it?

When I enter a limit order for an option, I can actually see it in the stock's
chart. Would there be any way to go the other way and get the price of the
option at a certain place/price in the stock's chart?

14  11 Comments  Share 

PROMOTED • Posted by u/IBKR_Official 6 days ago 

Access a full universe of US government securities, over


38,000 corporate bonds, 850,000 municipal securities and
33,000 CDs.

IBKR.com LEARN MORE

3  0 Comments  Share
https://www.reddit.com/r/thinkorswim/comments/ggwr50/is_it_possible_to_write_a_thinkscript_script_to/ 2/9
5/20/2020 Is it possible to write a ThinkScript script to make time-based buy/sell orders? : thinkorswim

Search
Posted by u/Lambda1001 6 days ago

How to separate long-term investment and day trading?


Hello everyone,

Just opened an account at TD and I would like to separate my long-term


investments from my short-term.

If I bought ABC stock for long term, I would like also to day trade it without
interfering with my long-term position.

But, I also would like to have the buying power and the PDT rule. I would like
to day trade with 10K but would like to have my 70K in my balance so I could
have good margin and no PDT.

How can it be done?

14  17 Comments  Share 

Posted by u/PillarsBliz 11 hours ago

Is there any way to disable the "Fast Market is LIVE" etc.


notifications?
I have contacted customer support once or twice, and all they say is that they
will report it as a feature request.

You used to get forced audio dings on the hour a few times a day, which was
tolerable. Now, you get audio dings at other times (e.g. 50 minutes after the
hour) so it is harder to predict when they were stock price alerts and when
they are annoying advertisements.

I like the platform, I'm on it, and I don't need advertised to. Forcing me to be
distracted by random audio dings without a way to disable it really irritates
me.

14  7 Comments  Share 

Posted by u/texas-hedge 1 day ago

Chart options price


Any way to chart the price of a spread/straddle etc. over time? I know how to
view a single option price, but I can’t figure how to do more than one leg.

10  3 Comments  Share 

Posted by u/Walletofwaffles 1 day ago

Thinkorswim order errors for anyone else?

https://www.reddit.com/r/thinkorswim/comments/ggwr50/is_it_possible_to_write_a_thinkscript_script_to/ 3/9
5/20/2020 Is it possible to write a ThinkScript script to make time-based buy/sell orders? : thinkorswim

When i tried to buy stock this morning my order wouldnt go through and i got
Search
error messages. My internet connection is good and it seems like a platform
issue. I contacted tdameritrade about it already and just wonder if its
happening to anyone else.

10  28 Comments  Share 

Posted by u/Jimz2018 22 hours ago

What is the 7 in SPY 100 26 MAY 20 (7) 288 P ?


Not all options have a number in parenthesis. What is it?

7  7 Comments  Share 

Posted by u/Gimme_All_Da_Tendies 3 days ago

How To Create a Column on on Option Hacker For a Custom


Script
Hello, I know how to hit the gear icon on the top right to select new columns in
the option hacker page.

But I want to be able to see the Prob.OTM divided by Return on Risk. I already
have those two columns added but I always find myself comparing the two
values amongst options.

Is there a way to create a custom column that is Prob.OTM / RoR?

I tried messing around in the custom script editor to no avail.

7  5 Comments  Share 

Posted by u/Alberto232 2 days ago

ThinkScript
Hello. I'd want to ask if it's possible to add a script that auto executes under
certain circumstances for buying and selling stocks automatically in
Thinkorswim. I've search for it but have found nothing. Thanks.

6  6 Comments  Share 

Posted by u/hwnfinance 4 days ago

How to show delta in option chains


I see delta in what I’m already holding in positions. But how can I get specific
Greeks showing in the quote chains? Mahalo all.

6  7 Comments  Share 

https://www.reddit.com/r/thinkorswim/comments/ggwr50/is_it_possible_to_write_a_thinkscript_script_to/ 4/9
5/20/2020 Is it possible to write a ThinkScript script to make time-based buy/sell orders? : thinkorswim

Search

https://www.reddit.com/r/thinkorswim/comments/ggwr50/is_it_possible_to_write_a_thinkscript_script_to/ 5/9
5/20/2020 Is it possible to write a ThinkScript script to make time-based buy/sell orders? : thinkorswim

Search

https://www.reddit.com/r/thinkorswim/comments/ggwr50/is_it_possible_to_write_a_thinkscript_script_to/ 6/9
5/20/2020 Is it possible to write a ThinkScript script to make time-based buy/sell orders? : thinkorswim

Search

https://www.reddit.com/r/thinkorswim/comments/ggwr50/is_it_possible_to_write_a_thinkscript_script_to/ 7/9
5/20/2020 Is it possible to write a ThinkScript script to make time-based buy/sell orders? : thinkorswim

Search

Posted by u/DeeelosHarriedman 4 days ago

Active Trader custom templates?


I can save templates from the Order Entry panel, but nothing ever appears in
Active Trader's template selector. They do show up in right-click "Buy custom"
lists, though.

So how do I make my custom templates show up in the Active Trader template


drop-down?

Is there a different way that I have to create them?

4  4 Comments  Share 

Posted by u/therealkelso1 5 days ago

Day Traders - Do you act when the market is in a range?


Do you typically Buy/Sell when the market is in a range or mostly when the
market broke out of the range (new HH/HL or new LL/HL)?

4  3 Comments  Share 

Posted by u/Lambda1001 5 days ago

thinkorswim for momentum trading [very slow]


Hello everyone,

i tried to day trade momentum for the past two days with thinkorswim - I have
a desktop with i5, 8GB ram, intel graphics gpu, 256SSD and only one monitor
used.

I upgraded the ram usage of thinkorswim in the options, but it's SO SLOW!

https://www.reddit.com/r/thinkorswim/comments/ggwr50/is_it_possible_to_write_a_thinkscript_script_to/ 8/9
5/20/2020 Is it possible to write a ThinkScript script to make time-based buy/sell orders? : thinkorswim

I tried to sell a share today (first 10 min of markets) and it took 3 minutes until
Search
it was shown as sold!! I had to quickly log into the mobile thinkorswim to make
that order filled...

4  21 Comments  Share 

Posted by u/themanmedina 5 days ago

Scans
When using the option hacker that there will be times when a contract will
flash purple. Any idea as to why that is?

4  1 Comment  Share 

Posted by u/Kansas92 5 days ago

Thinkorswim Paper Buying Power


Every time I login to my account my buying power automatically increases by
100k. Any ideas why? I also run into similar issues sometimes when I go to sell
a vertical option in that it will all of a sudden say by buying power is in the
negative by 98k.

4  5 Comments  Share 

Posted by u/LoneWolf15000 6 days ago

Trades being rejected...why???


Cash account so I wouldn’t think it could be a PDT issue Plenty of funds
“available for trading”

Placed a BUY this morning for 200 shares, no problem

Tried to enter 100 more at market and it got rejected immediately

Tried again 2 more times over the next 30 minutes and the same thing. What
could be the problem.

4  13 Comments  Share 

Continue browsing in r/thinkorswim

https://www.reddit.com/r/thinkorswim/comments/ggwr50/is_it_possible_to_write_a_thinkscript_script_to/ 9/9

You might also like