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

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

@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! :)
 
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.
 
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:
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);
 
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.
 
@christ No, that is not really possible in Thinkscript... But you do have that capability on the chart for that instrument...

RLAqwYd.png
 
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);
 
@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);
 
I'm looking for a column script that will spit out the $vol for a specific time frame. I'm looking specifically for $vol from 9:30-9:45.

Open to ideas/suggestions; thank you!
 
I'm looking for a column script that will spit out the $vol for a specific time frame. I'm looking specifically for $vol from 9:30-9:45.

Open to ideas/suggestions; thank you!

Use the Search feature to locate Opening Range Breakout (ORB) which uses the same timeframe for calculations... That code should get you going...
 
Any way to do this? AFAIK looking into the code there appears no way to extract volume data per price point ... unlike the volume data at the bottom of the charts
 
I'm looking for something similar. I'd like to convert the volume profile to a $ volume profile, so that each level of the histogram represents a $ volume at that price level rather than just volume alone. Even just multiplying the volume on each histogram bar by the rough price level of each histogram bar would give a nice approximation, but I've been looking at the volume profile code and I can't figure out a way to do that.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
457 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