I'm trying to view volume profile for a "QUARTER" (past 3 months) period, but not sure how to code it. Anyone have any suggestions? TOS volume profile code below.
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2010-2018
#
input pricePerRowHeightMode = {default AUTOMATIC, TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input timePerProfile = {default CHART, MINUTE, HOUR, HOUR2, HOUR4, HOUR9, DAY, DAY2, WEEK, MONTH, "OPT EXP", BAR, YEAR};
input multiplier = 1;
input onExpansion = no;
input profiles = 1000;
input showPointOfControl = yes;
input showValueArea = yes;
input valueAreaPercent = 70;
input opacity = 15;
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);
def year = getYear();
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 HOUR2:
period = Floor(seconds / 7200 + day_number * 24);
case HOUR4:
period = Floor(seconds / 14400 + day_number * 24);
case HOUR9:
period = Floor(seconds / 32400 + day_number * 24);
case DAY:
period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case DAY2:
period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 2;
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));