Quantity as dollar amount

A

aksatts

New member
Active trader doesn't allow cash (or % of buying power funds) to use so during trading time, the quantity must be calculated fairly accurate (with some offset) for a security. Calculating quantity during trading time is tricky if the stock price is moving fast. TD customer service said the only way to do this the fastest possible way is to go under Trade and build a custom buy template beforehand. So when the trading time comes for a stock, I need to put the stock ticker, do a right click and then choose that custom buy order template (with my dollar amount pre-filled). The custom buy template doesn't show in active trader window which I would prefer to use to place the trade. Also, even if I choose to go to the route of Trade -> Custom Buy order, shift hotkey doesn't seem to work and pops up with "confirm and send". What's the workaround to place a buy trade in the quickest possible way with a stock symbol and dollar amount? Coming from other platforms, I'm used to put a % or a dollar amount which is so easy.

If can't be done thru thinkorswim UI, can this be done by script? I don't know anything about scripting at all. Basically the script takes three parameters 1) stock symbol 2) dollar amount 3) an option to pick from either "buy market" or "buy at ask+0.01". Is this easily doable via a script? If yes, can I get some pointers or even better if there is an existing handy script I can reuse? Thank you.
 
P

Pensar

Active member
VIP
@aksatts To the best of my knowledge, thinkScript cannot be used to place orders (there are "conditional orders", but my understanding is that they are highly limited with what you can do, and I don't know much about them). Here's a couple thoughts I have after looking around in the platform.

... if I choose to go to the route of Trade -> Custom Buy order, shift hotkey doesn't seem to work and pops up with "confirm and send".
You might be able to go into Setup>General>Orders and adjust some settings with the popup, maybe try unchecking "show order confirmation". I'd test any changes in PaperMoney before trying it with live trading.
Active trader doesn't allow cash (or % of buying power funds) to use so during trading time, the quantity must be calculated fairly accurate (with some offset) for a security. Calculating quantity during trading time is tricky if the stock price is moving fast.
Perhaps try using a label that you pre-set the dollar amount per trade and shows you the max amount of shares to buy based on the current price of the stock? Then you could quickly enter the automatically calculated number of shares into the Active Trader "Qty" box and hit "Buy Market". Look at https://usethinkscript.com/threads/position-sizing-calculator-for-thinkorswim.589/. Or you could try this -

Code:
#Trade_Size_Calculator
input trade_size = 50000.00;

def Size = (trade_size / close);

AddLabel(1, "Total Trade Size: " + AsDollars(trade_size) +
         " --- Buy " + RoundDown(Size, 0) + " shares of " +
         GetSymbol(), color.white);
Hopefully this will provide some assistance. Happy trading to you! :)
 
A

aksatts

New member
Thank you @Pensar . appreciate your help and will follow through these tips.
 
G

Gabrielx77

Member
@Pensar This looks really good. Is there any way to swap out the close price with the high price from 9:30-9:35 am +$0.01?
 
A

aksatts

New member
That's a good question @Pensar ...I'm still learning more about the platform and this scripting language so don't have an answer but hoping may be other experts here can chime in. Ideally, I would like this label to show the "Current Market Price" + 1% (in case the price moves up fast). I have had a couple of buy market orders rejected due to the calculation being off by just 1-3 shares. TOS didn't even fill me partial shares if my quantity was higher by just those few shares. I hoped that won't be the case and it would have filled me lesser shares but it didn't (insufficient funds error).
 
G

Gabrielx77

Member
So I actually got a script for exactly what I was looking for @aksatts . I usually use a 5 min ORB Strategy, of course with good indicators and news catalyst, and was looking for script that I could enter to automatically calculate a dollar amount divided by the 5 min high +$0.01. After someone gave me a script to input, it's going to be super beneficial for me due to the amount of time I'll be saving (3-5 seconds, which doesn't seem like a lot, but when a stock is very volatile, that's a lot of time) when seeing how many shares I can buy compared to calculating how many shares I can buy; especially for momentum trading, this is excellent. Here is the link: https://tos.mx/xilNqLc . All you have to do is open TOS > go to SetUp > Open Shared Item > Paste Link > Click Open > Rename it > Go to Studies and Enter it.

What it does is create a label for me that I can see the amount of dollars I'd like to trade with divided by the high of the first 5 min. + $0.01. So if I input $1000 as my dollar amount and at 9:31 am, the high is at $1.01, it'll calculate the $1000/$1.02 to show me the amount of shares I can buy. And if the security increases to a high of $1.07 at 9:34 am, the label will adjust and show my $1000/$1.08.

You can also easily adjust it by changing the period end time to any time you want, your account balance to any amount you want, and your stock price adjustment to any increment you want. Hope that's useful for you; I wouldn't know how to change that into a percentage instead of stock price adjustment.
 

Similar threads

Top