Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to
register in order to view the content of the threads and start contributing to our community.
It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Programming "Year" into the Volume Profile
Updated November 3, 2021
Top Posters
looks_one
Massive l
with 6 posts (1 thanks)
looks_two
rmejia
with 3 posts (3 thanks)
looks_3
mmirza
with 1 posts (0 thanks)
looks_4
hsyed28
with 1 posts (0 thanks)
trending_up
5,490 views
thumb_up
4 thanks given
group
5 followers
forum
11 posts
attach_file
2 attachments
Programming "Year" into the Volume Profile
July 25th, 2012, 02:24 PM
OR/USA
Legendary /NQ Trader
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106
I want to add the option to have a yearly profile. I don't want to use Month and then 12 as the multiplier.
Here's the code. Any help would be greatly appreciated. Thank you!
input pricePerRowHeightMode = {default TICKSIZE, AUTOMATIC, CUSTOM};
input customRowHeight = 1.0;
input timePerProfile = {default DAY, MINUTE, HOUR, WEEK, CHART, MONTH, "OPT EXP", BAR};
input multiplier = 1;
input onExpansion = NO;
input profiles = 2;
input showPointOfControl = NO;
input showValueArea = NO;
input valueAreaPercent = 70;
input opacity = 50;
def period;
def yyyymmdd = getYyyyMmDd();
def seconds = secondsFromTime(0);
def month = getYear() * 12 + getMonth();
def day_number = daysFromDate(first(yyyymmdd)) + getDayOfWeek(first(yyyymmdd));
def dom = getDayOfMonth(yyyymmdd);
def dow = getDayOfWeek(yyyymmdd - dom + 1);
def expthismonth = (if dow > 5 then 27 else 20) - dow;
def exp_opt = month + (dom > expthismonth);
switch (timePerProfile) {
case CHART:
period = 0;
case MINUTE:
period = Floor(seconds / 60 + day_number * 24 * 60);
case HOUR:
period = Floor(seconds / 3600 + day_number * 24);
case DAY:
period = countTradingDays(Min(first(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case WEEK:
period = Floor(day_number / 7);
case MONTH:
period = Floor(month - first(month));
case "OPT EXP":
period = exp_opt - first(exp_opt);
case BAR:
period = barNumber() - 1;
}
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
July 28th, 2012, 09:42 AM
Puerto Rico
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441
I think these 3 additions should do the trick:
input timePerProfile = {default DAY, MINUTE, HOUR, WEEK, CHART, MONTH, "OPT EXP", BAR, YEAR};
def year = getYear();
case YEAR:
period = Floor(year - first(year));
and all toguether now:
input pricePerRowHeightMode = {default TICKSIZE, AUTOMATIC, CUSTOM};
input customRowHeight = 1.0;
input timePerProfile = {default DAY, MINUTE, HOUR, WEEK, CHART, MONTH, "OPT EXP", BAR, YEAR};
input multiplier = 1;
input onExpansion = NO;
input profiles = 2;
input showPointOfControl = NO;
input showValueArea = NO;
input valueAreaPercent = 70;
input opacity = 50;
def period;
def yyyymmdd = getYyyyMmDd();
def seconds = secondsFromTime(0);
def month = getYear() * 12 + getMonth();
def year = getYear()
def day_number = daysFromDate(first(yyyymmdd)) + getDayOfWeek(first(yyyymmdd));
def dom = getDayOfMonth(yyyymmdd);
def dow = getDayOfWeek(yyyymmdd - dom + 1);
def expthismonth = (if dow > 5 then 27 else 20) - dow;
def exp_opt = month + (dom > expthismonth);
switch (timePerProfile) {
case CHART:
period = 0;
case MINUTE:
period = Floor(seconds / 60 + day_number * 24 * 60);
case HOUR:
period = Floor(seconds / 3600 + day_number * 24);
case DAY:
period = countTradingDays(Min(first(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case WEEK:
period = Floor(day_number / 7);
case MONTH:
period = Floor(month - first(month));
case "OPT EXP":
period = exp_opt - first(exp_opt);
case BAR:
period = barNumber() - 1;
case YEAR:
period = Floor(year - first(year));
}
July 28th, 2012, 02:08 PM
OR/USA
Legendary /NQ Trader
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106
rmejia! ya da man. Thank you so much.
July 29th, 2012, 03:26 AM
OR/USA
Legendary /NQ Trader
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106
If you are ever in Oregon, I'll show you some mind blowing shit. Let me know!
July 29th, 2012, 07:49 AM
Puerto Rico
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441
lol, Oregon would be one heck of a trip, it's pretty far away from here. I considered moving to Portland after hearing the dream of the 90's was still alive there
July 30th, 2012, 11:39 AM
OR/USA
Legendary /NQ Trader
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106
August 7th, 2012, 06:20 PM
Puerto Rico
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441
I think you are missing the ";" at the end of the first line:
def year = getYear();
September 2nd, 2021, 12:16 PM
chicago, IL
Posts: 1 since Sep 2021
Thanks Given: 0
Thanks Received: 0
How I can get the Volume profile behind the chart like in attached in snapshot.
By default I am getting on right side of my prices
@rmejia help please
September 14th, 2021, 11:12 PM
OR/USA
Legendary /NQ Trader
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106
mmirza
How I can get the
Volume profile behind the chart like in attached in snapshot.
By default I am getting on right side of my prices
@
rmejia help please
In indicator settings change expansion to No
October 23rd, 2021, 03:58 PM
Pittsburgh PA
Posts: 1 since Oct 2021
Thanks Given: 0
Thanks Received: 0
Is it possible to have 4hour added to timePerProfile? I tried but couldn't get to work.
input timePerProfile = {default DAY, MINUTE, HOUR, WEEK, CHART, MONTH, "OPT EXP", BAR, YEAR};
Last Updated on November 3, 2021