$ 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:

SuryaKiranC

Well-known member
@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;

AddLabel(yes, AsDollars(DaysDollarVol), Color.WHITE);
 
Thread starter Similar threads Forum Replies Date
S Intraday volume indicator or study Questions 1
T Unusual Volume Scan within last 10 bars rather than just current bar Questions 2
C Finding lowest volume Questions 3
J Volume Indicator Questions 0
V Volume Overlay Scaling Questions 1

Similar threads

Top