# \$ Volume & 20day avg \$ Column

#### axlerod

##### Member
Hello,
Having a silly mental block today just can't understand if it's cuz i haven't slept in 2 days lol but need some help.

I have a custom column I am trying to do. 2 Custom Columns OUTPUT and \$ Dollar Volume

1. Volume Converted To \$ Dollar Volume Traded

EXAMPLE
CCTL 1d \$ Volume on 8/11 was \$1,224,723 and the volume was 365,589,039

I am trying to convert the VOLUME into \$ Volume on 1D time frame and can't get it to match I'm off by a few hundred.

Code:
``````plot DollarVolume = hl2 * Volume;

#also it's missing the , (commas) cuz it's showing the full 9 digits but without commas as I read on ThinkScript I can do AsDollars to make it have commas but didn't work.``````

2. OUTPUT
THEN I am trying to get this formula to match this equation. Todays \$ Volume / (divided) by the 20 day average \$ Dollar Volume.

EXAMPLE:
Output on 8/11 should be 9 but im getting something different. (Basically stating that on 8/11 the \$ Volume Traded TODAY was 9x greater than the 20day average)

Code:
``````def days20dollarvol = Average(volume, 20)*hl2;

def todaydollarvol = hl2 * volume;

plot output = todaydollarvol / days20dollarvol;``````

PREVIOUS 20 Days Data - I TYPED UP all the data for the Volume, \$ Volume and Output that it SHOULD BE when converted to the columns but it isn't working when I coded it in the columns. Google Sheets - https://docs.google.com/spreadsheets/d/1eC1kyAd0uCCaIBJReLLygPi3cRjG1jY5WtO3_asvNXc/edit?usp=sharing

If anyone can help me with this mental block that be great! Thank you god bless and hope everyone is safe and healthy!

Last edited:
@axlerod Try the following code in your custom column and let me know. Please note, my values is 30, you can change this to what you need.

Code:
``````# DollarTraded
# Version 0.1
# Created: 08/12/2020
# Created by: Surya Kiran C #

def length = 30;
def VolDayAvg = Average(volume(period = "DAY")[1], length);
def DollarVolume = hl2 * Volume(period = "DAY");
def DaysDollarVol = VolDayAvg * hl2;

Volume Profile Scan Questions 0
Volume Profile for 1st hour only Questions 1
Volume Profile Bubbles & Right Extension Questions 1
Volume Profile Watchlist Questions 1
price chart arrows when volume exceeds VolumeAvg(50) Questions 1

87k+ Posts
283 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?