# "Quarter" / 3 month Volume POC For ThinkOrSwim

#### Skyfly93

##### New member
Sharing the study with you since you were able to help me. Plots the value area of the designated time period.
Created by SleepZ here:
Code:
``````# =================================
# Volume Profile Definition Section
# =================================

def profiles = 50;
def customRowHeight = 1.0;
def multiplier = 1;
def onExpansion = ShowTodayOnly;
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 qtr = if getmonth()==1 then 1 else if getmonth()==4 then 2 else if getmonth()==7 then 3 else if getmonth()==10 then 4 else qtr[1];
def period = qtr ;
#floor(qtr - first(qtr));
def height = PricePerRow.TICKSIZE;

rec count = CompoundValue(1, if period != period[1] then (count[1] + period - period[1]) % multiplier else count[1], 0);
def cond = if period==qtr then period!=period[1] else count < count[1] + period - period[1];

#============================
# Plot POC VAH VAL Section
#============================

profile tpo = if ProfileType == ProfileType.Volume then VolumeProfile("startNewProfile" = cond, "onExpansion" = onExpansion, "numberOfProfiles" = profiles, "pricePerRow" = height, "value area percent" = valueAreaPercent)
else TimeProfile("startNewProfile" = cond, "onExpansion" = onExpansion, "numberOfProfiles" = profiles, "pricePerRow" = height, "value area percent" = valueAreaPercent);

rec PC = if cond == 1 then tpo.GetPointOfControl()[1] else PC[1];
plot POC = Round(If(ValueAreaMode == ValueAreaMode."Auto", PC, if NewDay then PointOfControl else PC) / TickSize(), 0) * TickSize();
POC.SetDefaultColor(Color.WHITE);
POC.SetStyle(Curve.FIRM);
POC.SetLineWeight(2);
AddChartBubble(bar == HighestAll(bar) and ShowBubbles, POC, "POC", Color.WHITE, no);

rec hVA = if cond == 1 then tpo.GetHighestValueArea()[1] else hVA[1];
plot VAH = Round(If(ValueAreaMode == ValueAreaMode."Auto", hVA, if NewDay then ValueAreaHigh else hVA) / TickSize(), 0) * TickSize();
VAH.SetDefaultColor(Color.PINK);
VAH.SetStyle(Curve.FIRM);
AddChartBubble(bar == HighestAll(bar) and ShowBubbles, VAH, "VAH", Color.PINK, no);

rec lVA = if cond == 1 then tpo.GetLowestValueArea()[1] else lVA[1];
plot VAL =  Round(If(ValueAreaMode == ValueAreaMode."Auto", lVA, if NewDay then ValueAreaLow else lVA) / TickSize(), 0) * TickSize();

VAL.SetDefaultColor(Color.Light_GREEN);
VAL.SetStyle(Curve.FIRM);
AddChartBubble(bar == HighestAll(bar) and ShowBubbles, VAL, "VAL", Color.Light_GREEN, no);

#============================
# VWAP Plot
#============================
def VWAP1 = Round(vwap(period = AggregationPeriod.QUARTER) / TickSize(), 0) * TickSize();
plot VWAP = if ShowVWAP > 0 then VWAP1 else Double.NaN;
VWAP.SetPaintingStrategy(PaintingStrategy.DASHES);
VWAP.SetDefaultColor(Color.YELLOW);

#============================
#Value Area Cloud & Labels
#============================

def VArea  = Between(close, VAL, VAH);
def VAreaAbove  = close > VAH;
def VAreaBelow  = close < VAL;

def Cloudhigh = if ShowCloud then VAH else Double.NaN;
def Cloudlow  = if ShowCloud then VAL else Double.NaN;
DefineGlobalColor("cloud", Color.GRAY);``````

Last edited by a moderator:

87k+ Posts
255 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?