Volume POC line to extend right all the way across the screen

Would it be possible to add a line of code to have this volume profile study POC line extend to the right for however many days you have it set for? I want the POC line to extend right all the way across the screen.

Code:
#
# TD Ameritrade IP Company, Inc. (c) 2010-2022
#

input pricePerRowHeightMode = {default AUTOMATIC, TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input timePerProfile = {default CHART, MINUTE, HOUR, DAY, WEEK, MONTH, "OPT EXP", BAR};
input multiplier = 1;
input onExpansion = yes;
input profiles = 1000;
input showPointOfControl = yes;
input showValueArea = yes;
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;
}

def count = CompoundValue(1, if period != period[1] then (count[1] + period - period[1]) % multiplier else count[1], 0);
def cond = count < count[1] + period - period[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;

plot POC = if plotsDomain then pc else Double.NaN;
plot ProfileHigh = if plotsDomain then hProfile else Double.NaN;
plot ProfileLow = if plotsDomain then lProfile else Double.NaN;
plot VAHigh = if plotsDomain then hVA else Double.NaN;
plot VALow = if plotsDomain then lVA else Double.NaN;

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

vol.show(globalColor("Profile"), 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));
ProfileHigh.hide();
ProfileLow.hide();
 
Last edited by a moderator:
Solution
Would it be possible to add a line of code to have this volume profile study POC line extend to the right for however many days you have it set for? I want the POC line to extend right all the way across the screen.

#
# TD Ameritrade IP Company, Inc. (c) 2010-2022
#

input pricePerRowHeightMode = {default AUTOMATIC, TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input timePerProfile = {default CHART, MINUTE, HOUR, DAY, WEEK, MONTH, "OPT EXP", BAR};
input multiplier = 1;
input onExpansion = yes;
input profiles = 1000;
input showPointOfControl = yes;
input showValueArea = yes;
input valueAreaPercent = 70;
input opacity = 50;

def period;
def yyyymmdd = getYyyyMmDd();
def seconds = secondsFromTime(0);
def month = getYear() * 12 +...
Would it be possible to add a line of code to have this volume profile study POC line extend to the right for however many days you have it set for? I want the POC line to extend right all the way across the screen.

#
# TD Ameritrade IP Company, Inc. (c) 2010-2022
#

input pricePerRowHeightMode = {default AUTOMATIC, TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input timePerProfile = {default CHART, MINUTE, HOUR, DAY, WEEK, MONTH, "OPT EXP", BAR};
input multiplier = 1;
input onExpansion = yes;
input profiles = 1000;
input showPointOfControl = yes;
input showValueArea = yes;
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;
}

def count = CompoundValue(1, if period != period[1] then (count[1] + period - period[1]) % multiplier else count[1], 0);
def cond = count < count[1] + period - period[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;

plot POC = if plotsDomain then pc else Double.NaN;
plot ProfileHigh = if plotsDomain then hProfile else Double.NaN;
plot ProfileLow = if plotsDomain then lProfile else Double.NaN;
plot VAHigh = if plotsDomain then hVA else Double.NaN;
plot VALow = if plotsDomain then lVA else Double.NaN;

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

vol.show(globalColor("Profile"), 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));
ProfileHigh.hide();
ProfileLow.hide();

You cannot extend a plot of the poc, for prior periods, without having each of those poc's having a separate plot statement.

So, I have extended the plot of the pocs for a "DAY" only setting in a separate script that will plot today and 10 previous period's pocs.

The image shows the standard TOS Volume Profile study set to "DAY" showing on the chart along with the additional study to do the exxpended plots. Optional bubbles were added to display the basis for the extended POC lines.

Screenshot-2023-03-15-140637.png
Ruby:
#VPOC
#The study that zzz posted displays the last 5 VPOC and provides an excellent visual as to where an instrument trades relative to the cluster of VPOCs during the past several sessions. Franz uses this cluster of VPOCs to determine the probable direction of the market.

#If price action is trading very close to the cluster of VPOCs, this means that the market is in balance. Should the market trade above this cluster of VPOCs and continue to move higher from there, we may consider a buy at the bottom of the VAL (value area low). Conversely, if the market trades below the cluster of VPOCs, then we’ll be looking for a short entry.

#This is essentially a play on support and resistance. VPOC can be viewed as clusters of support (floor) or resistance (ceiling) zones. If one floor breaks, then it is likely going to trade to the next floor, etc.

#Franz's setup is detailed here http://tos.mx/mVEhr9# For more background information on the subject, read the CME Market Profile Handbook

input painthigh = 4;#Hint painthigh: 1=dots,2=dashes,3=squares,4=horizontal
def paintingStrategyhigh = if painthigh == 1 then PaintingStrategy.POINTS else if painthigh == 4 then PaintingStrategy.DASHES else if painthigh == 3 then PaintingStrategy.SQUARES else PaintingStrategy.HORIZONTAL;
input colorhigh = 0;#Hint colorhigh: 0=magenta,1=cyan,2=light-red,3=light_green,4=yellow,5=red,6=green,7=light_gray,8=gold,9=white


def volp = reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE");

def ymd = GetYYYYMMDD();
def capture  = !IsNaN(close) and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay  = (HighestAll(dayCount) - dayCount) ;

rec pivot0 = if IsNaN(close) then pivot0[1] else if thisDay == 0 then volp else pivot0[1];
plot pp0 = pivot0;
pp0.SetPaintingStrategy(paintingStrategyhigh);
pp0.SetDefaultColor(GetColor(colorhigh));
rec pivot1 = if thisDay == 1 then volp else pivot1[1];
plot pp1 = pivot1;
pp1.SetPaintingStrategy(paintingStrategyhigh);
pp1.SetDefaultColor(GetColor(colorhigh));
rec pivot2 = if thisDay == 2 then volp else pivot2[1];
plot pp2 = pivot2;
pp2.SetPaintingStrategy(paintingStrategyhigh);
pp2.SetDefaultColor(GetColor(colorhigh));
rec pivot3 = if thisDay == 3 then volp else pivot3[1];
plot pp3 = pivot3;
pp3.SetPaintingStrategy(paintingStrategyhigh);
pp3.SetDefaultColor(GetColor(colorhigh));
rec pivot4 = if thisDay == 4 then volp else pivot4[1];
plot pp4 = pivot4;
pp4.SetPaintingStrategy(paintingStrategyhigh);
pp4.SetDefaultColor(GetColor(colorhigh));
rec pivot5 = if thisDay == 5 then volp else pivot5[1];
plot pp5 = pivot5;
pp5.SetPaintingStrategy(paintingStrategyhigh);
pp5.SetDefaultColor(GetColor(colorhigh));
rec pivot6 = if thisDay == 6 then volp else pivot6[1];
plot pp6 = pivot6;
pp6.SetPaintingStrategy(paintingStrategyhigh);
pp6.SetDefaultColor(GetColor(colorhigh));
rec pivot7 = if thisDay == 7 then volp else pivot7[1];
plot pp7 = pivot7;
pp7.SetPaintingStrategy(paintingStrategyhigh);
pp7.SetDefaultColor(GetColor(colorhigh));
rec pivot8 = if thisDay == 8 then volp else pivot8[1];
plot pp8 = pivot8;
pp8.SetPaintingStrategy(paintingStrategyhigh);
pp8.SetDefaultColor(GetColor(colorhigh));
rec pivot9 = if thisDay == 9 then volp else pivot9[1];
plot pp9 = pivot9;
pp9.SetPaintingStrategy(paintingStrategyhigh);
pp9.SetDefaultColor(GetColor(colorhigh));
rec pivot10 = if thisDay == 10 then volp else pivot10[1];
plot pp10 = pivot10;
pp10.SetPaintingStrategy(paintingStrategyhigh);
pp10.SetDefaultColor(GetColor(colorhigh));

input showbubbles = yes;
input bubblemover = 2;
def b = bubblemover;
def b1 = b + 1;
def mover = showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]);
AddChartBubble(mover, pivot0[b1], "P0", pp0.TakeValueColor());
AddChartBubble(mover, pivot1[b1], "P1", pp1.TakeValueColor());
AddChartBubble(mover, pivot2[b1], "P2", pp2.TakeValueColor());
AddChartBubble(mover, pivot3[b1], "P3", pp3.TakeValueColor());
AddChartBubble(mover, pivot4[b1], "P4", pp4.TakeValueColor());
AddChartBubble(mover, pivot5[b1], "P5", pp5.TakeValueColor());
AddChartBubble(mover, pivot6[b1], "P6", pp6.TakeValueColor());
AddChartBubble(mover, pivot7[b1], "P7", pp7.TakeValueColor());
AddChartBubble(mover, pivot8[b1], "P8", pp8.TakeValueColor());
AddChartBubble(mover, pivot9[b1], "P9", pp9.TakeValueColor());
AddChartBubble(mover, pivot10[b1], "P10", pp10.TakeValueColor());
 
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
213 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