Dollar Volume Indicator for ThinkorSwim

GuitarSlinger81

New member
Is anyone aware of an indicator that displays as bars just like volume, but instead of share volume it's dollar volume? I did some Googling and looked around in TOS, but I couldn't find anything. Perhaps if this doesn't exist it would make a good first project for me, since I'm learning ThinkScript.
 

JL356

New member
IS there a watchlist column, to convert shares to millions (37,235,451 to 37M) have one for volume, but not shares. Thanks in advance.

Thanks @GuitarSlinger81, all i want is a way to translate the shares amount, to Millions, to they dont take so much space. (51,125,478 to 51.2M)
 

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.
 

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! :)
 

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

Gabrielx77

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

evanevans

Member
How can I get DollarVolume to show up as an addable column in a scan?

I created the following study:

Code:
plot DollarVolume = close * volume;

# DollarVolume

AddLabel(yes, AsDollars(DollarVolume), Color.WHITE);

But it doesn't show up in the list for columns in the scan tab.

Can anybody help with this? trying to make a custom column study to show the current cumulative dollars traded on the day (volume * price each minute added together). @Welkin my buddy, how are you?

Code:
def RunningDollarVolume = CompoundValue(1, (RunningDollarVolume[1]*Close[1]) + (volume*close), volume*close);

plot TotalDollarVolume = RunningDollarVolume;

Ok, nevermind, I think I got it. Here's the SHARE LINK to the code, for anyone who wants to add it as a column:
http://tos.mx/yaHbUmX

CODE:

Code:
def RunningDollarVolume = CompoundValue(1, (RunningDollarVolume[1]) + (volume*close), volume*close);

plot TotalDollarVolumeMM = Round(RunningDollarVolume/1000000,1);

FYI, because it was putting out some large numbers, I rounded it to the millions.

Does anybody know how to make a DollarVolume lower indicator, so instead of Volume it plots DollarVolume? It would look the same as volume, just the units expressed would not be volume of shares/contracts traded in one bar, but rather in Dollars (Volume*(OHLC/4)) or perhaps it can be reverse engineered from VWAP.
 
Last edited by a moderator:

jngy2k

Member
VIP
I've been researching on how to get the most accurate $ Volume on TOS. I can't find a constant that will bring up data of volume for each traded price$.

A formula has to be used.

The simplest way seems to be price(High + Low)/2 * volume. A code from a chart study by @SuryaKiranC uses def DollarVolume = hl2 * Vol; def AvgHL2 = Average(hl2[1], length); def DaysDollarvol = VolDayAvg * AvgHL2;

Even simpler would be use close * volume.

I'm not sure but maybe VWAP * volume would be most accurate but not sure if it can be done?

Does anyone know a good scan or column function for this problem?

My reasoning for using $ volume is if my account gets bigger and I want to use more size for one stock then it is more important to know how much $ Dollar Volume instead of simple Volume of shares traded because $ Volume standardizes all the stocks in the scan by accounting $ per shares traded as a priority instead of only shares. A 100k volume in 1$ stock is different than 10$ at the same volume.
 
Last edited by a moderator:

evanevans

Member
Excellent for spotting divergences from the actual volume indicator.

The issue with volume, is at lower prices you could get a higher volume bar, than another volume bar which was at a higher price, and actually MORE MONEY was put into the lower volume bar at the higher prices overall. So when you thought you might have bearish divergence, you actually have bullish confirmation.

If you ask me, this is the better way to view volume...in terms of dollars traded, since it normalizes to a unit that is on the price chart (namely price).

Code:
# Dollar Volume Indicator
# ©2020
# Evan Evans
# evanevans333 (at) gmail

plot DollarVolume = close * volume;
DollarVolume.AssignValueColor(if close>close[1] then color.uptick else color.downtick);

# DollarVolume

AddLabel(yes, AsDollars(DollarVolume), Color.WHITE);
 

tonyd

New member
VIP
HI new to TOS and looking to create a Volume scanner that shows stocks that have traded more than 9million Shares in the past Year and which you can change the look back period to 6 months, 3 months etc.
As part of the scan would it be possible to show how many days each stock traded upwards of more than 4% as an example.
 

rad14733

Well-known member
VIP
HI new to TOS and looking to create a Volume scanner that shows stocks that have traded more than 9million Shares in the past Year and which you can change the look back period to 6 months, 3 months etc.
As part of the scan would it be possible to show how many days each stock traded upwards of more than 4% as an example.

@tonyd Do you mean a daily average volume of 9M for Y, 6M, 3M...??? Yes, that can be done in the Stock Hacker Scanner... Only an average though, not 9M+ every single day...
 

christ

New member
Hello,

I was wondering if it was possible to script a label that tells the ammount of dollars traded in the current day since premarket till close, at the market open till close and only in the premarket.
 

rad14733

Well-known member
VIP
@christ No, that is not really possible in Thinkscript... But you do have that capability on the chart for that instrument...

RLAqwYd.png
 

christ

New member
Let me be more clear is not that clear what i wrote before:
What i want to know is the ammount of dollars traded by the ticker through out the day not by me. Here down there is an example.
The issue that i have is when i have the ticker in 1min timeframe it doesn't give me the right ammount of dollars but when i use the 1d timeframe it gives me the right ammount of dollars traded.

#Daily dollars

Def DollarVolume = vwap * volume (Period=aggregationPeriod.DAY);
AddLabel(yes, "Daily Dollars:" + AsDollars(DollarVolume), Color.WHITE);
 

rad14733

Well-known member
VIP
@christ The following code resolves the problem... I believe this has to do with bar aggregation of the current bar not being closed... By keeping aggregations aligned we get consistent results... Granted, VWAP should be the same across timeframes, but only if all bars are closed in this case... OR it may have been due to volume not tallying due to the bar not being closed... At any rate, I think that's why you were seeing different values... The fluctuating VWAP is the culprit, just as it would be if you calculated by moving average price...

Ruby:
#Daily dollars

Def DollarVolume = vwap(Period=aggregationPeriod.DAY) * volume(Period=aggregationPeriod.DAY);
AddLabel(yes, "Daily Dollars:" + AsDollars(DollarVolume), Color.WHITE);
 

Similar threads

Top