Make volume profile plot in lower study section identical to how it plots on 10m price candle chart?

lmk99

Active member
VIP
Hello everyone, I had been looking for a way to access the volume profile point of control on a lower study without causing scaling problems, and this was finally solved by re-scaling the other plots to the range of the price chart (solution was shared here) in a way that still preserved the original shape of histograms that have negative values, and thus allowed them to continue plotting normally.

However, now that I can use the volume profile in the lower study section without creating scaling problems, there is a different problem: I want the volume profile to act the same in the lower study section as it does when it appears on a 10M price candle chart, but it doesn't work. The point of control lines don't match the lines on the upper price chart area. I think it might be due to the input parameters of the volume profile needing to be modified in the script to replicate the environment or inputs of the 10M price candle chart. Does anyone have an idea of how to do this?

Code:
# NextSignals volume profile with POC and POC extensions

def zero = 0;
#zero.setdefaultcolor(color.black);

#addlabel(yes," POC ",createcolor(100,0,255));

input pricePerRowHeightMode = {default TICKSIZE, AUTOMATIC};
input timePerProfile = {default Bar, CHART};
def onExpansion = no;
def period;
switch (timePerProfile) {
case CHART:
period = 0;
case Bar:
period = BarNumber() - 1;}
rec count = if period != period[1] then (count[1] + period - period[1]) % 20 else count[1];
def cond = count < count[1] + period - period[1];
def height;
switch (pricePerRowHeightMode) {
case AUTOMATIC:
height = PricePerRow.AUTOMATIC;
case TICKSIZE:
height = PricePerRow.TICKSIZE;}
profile vol = VolumeProfile("startNewProfile" = cond, "onExpansion" = onExpansion, "numberOfProfiles" = 1000, "pricePerRow" = height, "value area percent" = 68);
def con = CompoundValue(1, onExpansion, no);
def pc = if IsNaN(vol.GetPointOfControl()) and con then pc[1] else vol.GetPointOfControl();
def plotsDomain = IsNaN(close) == onExpansion;
vol.Show(CreateColor(40,60,80));

plot POC = if plotsDomain then pc else Double.NaN;
POC.setpaintingstrategy(paintingstrategy.horizontal);
POC.setdefaultcolor(createcolor(100,0,255));
POC.setlineweight(3);
POC.hidebubble();
POC.hidetitle();

profile tpo = timeProfile("startNewProfile" = cond, "onExpansion" = onExpansion, "numberOfProfiles" = 1000, "pricePerRow" = height, "value area percent" = 68);
def tpoPC = if IsNaN(tpo.getPointOfControl()) and con then tpoPC[1] else tpo.getPointOfControl();
plot tpoPOC = if plotsDomain then tpoPC else Double.NaN;
tpoPOC.setpaintingstrategy(paintingstrategy.horizontal);
tpoPOC.setdefaultcolor(createcolor(100,0,255));
tpoPOC.setlineweight(3);
tpoPOC.hidebubble();
tpoPOC.hidetitle();

### POC extensions

def y= if !IsNaN(pc) then pc else y[1];
plot vpocext = y[20];
vpocext.SetDefaultColor(CreateColor(100,0,255));
vpocext.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
vpocext.SetStyle(Curve.SHORT_DASH);
vpocext.HideBubble();
vpocext.HideTitle();

def x = if !IsNaN(tpoPC) then tpopc else x[1];
plot tpoext = x[20];
tpoext.SetDefaultColor(CreateColor(100,0,255));
tpoext.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
tpoext.SetStyle(Curve.SHORT_DASH);
tpoext.HideBubble();
tpoext.HideTitle();

It's not clear to me how the input parameters would need to be modified or whether that can fix the issue and thereby cause the profile to appear the same way as it does on the upper price chart. If anyone has any ideas, I would be grateful for your help.
 

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