$ Volume & 20day avg $ Column


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

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.

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.

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

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)

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.

# 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;

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

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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