TOS VolumeProfile plot at a specific time.

Learnbot

Active member
Hello, I have the following code that I adopted from TOS's VolumeProfile. I was wondering if there is a way to plot POC, VAhigh and VAlow lines for values from 15-minute aggregation and specific time such as 0915am-0930am?

I have tried adopting ORB code to see if I can make this work with ORB logic but failed, so was wondering if anyone else has any ideas/suggestions or is even possible.


Code:
input valueAreaPercent = 70;
input onExpansion = yes;
input opacity = 50;
input profiles = 1000;



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

profile vol = volumeProfile("startNewProfile" = cond, "onExpansion" = onExpansion, "numberOfProfiles" = profiles, "value area percent" = valueAreaPercent);

def pc = vol.getPointOfControl();
def hVA = vol.getHighestValueArea();
def lVA = vol.getLowestValueArea();

def plotsDomain = IsNaN(close) and onExpansion;

plot POC = if plotsDomain then HighestAll(pc) else Double.NaN;
plot VAHigh = if plotsDomain then HighestAll(hVA) else Double.NaN;
plot VALow = if plotsDomain then HighestAll(lVA) else Double.NaN;

DefineGlobalColor("Point Of Control", GetColor(5));
DefineGlobalColor("Value Area", GetColor(8));

POC.SetDefaultColor(globalColor("Point Of Control"));
POC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
POC.SetLineWeight(2);
POC.SetStyle(Curve.SHORT_DASH);

VAHigh.SetDefaultColor(globalColor("Value Area"));
VAHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetLineWeight(2);

VALow.SetDefaultColor(globalColor("Value Area"));
VALow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VALow.SetLineWeight(2);
 
Solution
Hello, I have the following code that I adopted from TOS's VolumeProfile. I was wondering if there is a way to plot POC, VAhigh and VAlow lines for values from 15-minute aggregation and specific time such as 0915am-0930am?

I have tried adopting ORB code to see if I can make this work with ORB logic but failed, so was wondering if anyone else has any ideas/suggestions or is even possible.

This is a modification of code that I previously posted that may help
It breaks the volumeprofile into 3 different zones.
Your requested are, 915 to 930, (input zone2_begin = 0915; to input zone3_begin = 0930;) is Zone 2
You can choose which Zone to be displayed at input zones_display = {default all, zone1_only...
Hello, I have the following code that I adopted from TOS's VolumeProfile. I was wondering if there is a way to plot POC, VAhigh and VAlow lines for values from 15-minute aggregation and specific time such as 0915am-0930am?

I have tried adopting ORB code to see if I can make this work with ORB logic but failed, so was wondering if anyone else has any ideas/suggestions or is even possible.

This is a modification of code that I previously posted that may help
It breaks the volumeprofile into 3 different zones.
Your requested are, 915 to 930, (input zone2_begin = 0915; to input zone3_begin = 0930;) is Zone 2
You can choose which Zone to be displayed at input zones_display = {default all, zone1_only, zone2_only, zone3_only};
You can choose to extend Zone Only lines at input extend_lines = yes;
You can control whether to display Profile high/low lines at input show_profilehigh_low = yes;

Screenshot 2025-06-14 134808.jpg
Code:
#VolumeProfile break at trading zones_Choices_of_Displaying_Zones

input zone1_begin = 0400;
input zone2_begin = 0915;
input zone3_begin = 0930;

input zones_display        = {default all, zone1_only, zone2_only, zone3_only};
input show_profilehigh_low = yes;
input extend_lines         = yes;

input pricePerRowHeightMode = {AUTOMATIC, default TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input onExpansion = no;
input profiles = 1000;
input showPointOfControl = yes;
input showValueArea = yes;
input valueAreaPercent = 70;
input opacity = 20;

def na = Double.NaN;
def tz = if SecondsFromTime(zone1_begin) >= 0 and SecondsFromTime(zone2_begin) < 0 then 1
         else if SecondsFromTime(zone2_begin) >= 0 and SecondsFromTime(zone3_begin) < 0 then 2
         else if SecondsFromTime(zone3_begin) >= 0 then 3 else tz[1];

def zone;
switch (zones_display) {
case zone1_only:
    zone = 1;

case zone2_only:
    zone = 2;

case zone3_only:
    zone = 3;

case all:
    zone = Double.NaN;
}

input show_label = yes;
AddLabel(show_label, (if IsNaN(zone) then "Displaying ALL Zones" else "Displaying Only Zone == " + zone) + (if zone and extend_lines then ", Extended" else ""), Color.YELLOW);
AddLabel(show_label and show_profilehigh_low, "Profiles High/Low Displayed", Color.WHITE);

def cond = tz != tz[1];
def height;
switch (pricePerRowHeightMode) {
case AUTOMATIC:
    height = PricePerRow.AUTOMATIC;
case TICKSIZE:
    height = PricePerRow.TICKSIZE;
case CUSTOM:
    height = customRowHeight;
}

profile vol = VolumeProfile("startNewProfile" = cond, "onExpansion" = onExpansion, "numberOfProfiles" = profiles, "pricePerRow" = height, "value area percent" = valueAreaPercent);
def con = CompoundValue(1, onExpansion, no);
def pc = if IsNaN(vol.GetPointOfControl()) and con then pc[1] else vol.GetPointOfControl();
def hVA = if IsNaN(vol.GetHighestValueArea()) and con then hVA[1] else vol.GetHighestValueArea();
def lVA = if IsNaN(vol.GetLowestValueArea()) and con then lVA[1] else vol.GetLowestValueArea();

def hProfile = if IsNaN(vol.GetHighest()) and con then hProfile[1] else vol.GetHighest();
def lProfile = if IsNaN(vol.GetLowest()) and con then lProfile[1] else vol.GetLowest();
def plotsDomain = IsNaN(close) == onExpansion;

def POC_         = if if IsNaN(zone) then plotsDomain
                      else plotsDomain and tz == zone then pc
                   else if !extend_lines then na
                   else POC_[1];
def ProfileHigh_ = if if IsNaN(zone) then plotsDomain
                      else plotsDomain and tz == zone then hProfile
                   else if !extend_lines then na
                   else ProfileHigh_[1];
def ProfileLow_  = if if IsNaN(zone) then plotsDomain
                      else plotsDomain and tz == zone then lProfile
                   else if !extend_lines then na
                   else ProfileLow_[1];
def VAHigh_      = if if IsNaN(zone) then plotsDomain
                      else plotsDomain and tz == zone then hVA
                   else if !extend_lines then na
                   else VAHigh_[1];
def VALow_      = if if IsNaN(zone) then plotsDomain
                     else plotsDomain and tz == zone then lVA
                  else if !extend_lines then na 
                  else VALow_[1];

plot POC = POC_;
plot VAHigh = VAHigh_;
plot VALow = VALow_;
plot ProfileHigh = if !show_profilehigh_low then na else ProfileHigh_;
plot ProfileLow = if !show_profilehigh_low then na else ProfileLow_;

DefineGlobalColor("Profile", GetColor(1));
DefineGlobalColor("Point Of Control", GetColor(5));
DefineGlobalColor("Value Area", GetColor(8));

#vol.Show(#GlobalColor("Profile")
#color.gray, if showPointOfControl then GlobalColor("Point Of Control") else Color.CURRENT, if showValueArea then GlobalColor("Value Area") else Color.CURRENT, opacity);
POC.SetDefaultColor(GlobalColor("Point Of Control"));
POC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VALow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetDefaultColor(GlobalColor("Value Area"));
VALow.SetDefaultColor(GlobalColor("Value Area"));
ProfileHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileHigh.SetDefaultColor(GetColor(3));
ProfileLow.SetDefaultColor(GetColor(3));

input bubbles = yes;
input n  = 2;
def   n1 = n + 1;
AddChartBubble(bubbles and !IsNaN(close[n1]) and IsNaN(close[n]), VAHigh[n1], "VAH", color = Color.YELLOW, yes);
AddChartBubble(bubbles and !IsNaN(close[n1]) and IsNaN(close[n]), VALow[n1], "VAL", Color.YELLOW, no);
AddChartBubble(bubbles and !IsNaN(close[n1]) and IsNaN(close[n]), POC[n1], "POC", Color.RED, no);

#
 
Solution

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
347 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.
Back
Top