Quant Volume Profile / Point of Control

astrokjackk1

New member
Plus
Good evening everyone, there is a YouTube channel called Quant Trading App and they provided a free TOS script that showcases daily volume profile and point of control, since its free i believe i am allowed to post script:

#
# Quant Trading App Volume Profile
# Created: September 15, 2021
#
# Credit: Bryant Littrean, Thinkorswim
# Trading Litt Youtube: https://bit.ly/trading-litt-yt

def multiplier = 1; def onExpansion = no; def profiles = 1000; input showPointOfControl = yes; input showValueArea = yes; input valueAreaPercent = 68; input opacity = 60; 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); period = countTradingDays(min(first(yyyymmdd), yyyymmdd), yyyymmdd) - 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 = PricePerRow.TICKSIZE; 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", CreateColor(70, 70, 70)); DefineGlobalColor("Point Of Control", CreateColor(255, 215, 0)); DefineGlobalColor("Value Area", CreateColor(95, 140, 230)); 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); POC.SetLineWeight(2); 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();


I want to know what needs to be changed in order to see weekly volume profile and monthly volume profile but i dont know how to code.
Thanks in advance!
 
Last edited by a moderator:
Good evening everyone, there is a YouTube channel called Quant Trading App and they provided a free TOS script that showcases daily volume profile and point of control, since its free i believe i am allowed to post script:

#
# Quant Trading App Volume Profile
# Created: September 15, 2021
#
# Credit: Bryant Littrean, Thinkorswim
# Trading Litt Youtube: https://bit.ly/trading-litt-yt

def multiplier = 1; def onExpansion = no; def profiles = 1000; input showPointOfControl = yes; input showValueArea = yes; input valueAreaPercent = 68; input opacity = 60; 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); period = countTradingDays(min(first(yyyymmdd), yyyymmdd), yyyymmdd) - 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 = PricePerRow.TICKSIZE; 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", CreateColor(70, 70, 70)); DefineGlobalColor("Point Of Control", CreateColor(255, 215, 0)); DefineGlobalColor("Value Area", CreateColor(95, 140, 230)); 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); POC.SetLineWeight(2); 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();


I want to know what needs to be changed in order to see weekly volume profile and monthly volume profile but i dont know how to code.
Thanks in advance!

Added input timeperprofile for your selection and a switch statement to define the selected period

Ruby:
#
# Quant Trading App Volume Profile
# Created: September 15, 2021
#
# Credit: Bryant Littrean, Thinkorswim
# Trading Litt Youtube: https://bit.ly/trading-litt-yt
# 20220427 Sleepyz added timeperprofile for Day, Week, Month options

def multiplier = 1;
def onExpansion = no;
def profiles = 1000;
input timeperprofile = {default Day, Week, Month};
input showPointOfControl = yes;
input showValueArea = yes;
input valueAreaPercent = 68;
input opacity = 60;
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 DAY:
    period = countTradingDays(min(first(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case WEEK:
    period = floor(day_number / 7);
case MONTH:
    period = floor(month - first(month));
}
#period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 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 = PricePerRow.TICKSIZE;
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", CreateColor(70, 70, 70));
DefineGlobalColor("Point Of Control", CreateColor(255, 215, 0));
DefineGlobalColor("Value Area", CreateColor(95, 140, 230));
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);
POC.SetLineWeight(2);
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();
 
Added input timeperprofile for your selection and a switch statement to define the selected period
@SleepyZ Hi, I'm wondering if you can help me with this ThinkScript question for Volume Profile POC? I'm not sure if it is possible...
My problem: I want my POC Line referencing the Monthly chart. To plot out the POC, I switch my chart to the 10-Day 30-Minute timeframe and manually plot the price level of the POC... The problem is, the POC seems to always be changing when I use a different timeframe, such as today's 5-minute chart. Every 30 days, a new POC will be established, and I always like to keep the prior's month POC manually plotted as well - - so I always have 2 Monthly-POC marked using the 10-Day 30-Minute timeframe.
My question: is it possible to edit this Volume Profile script to correctly show the Monthly-POC from the 10-Day 30-Minute timeframe, on all smaller timeframes I switch to?


Code:
input pricePerRowHeightMode = {default TICKSIZE};
input customRowHeight = 1.0;
input timePerProfile = {default MONTH, MINUTE, HOUR, DAY, WEEK, CHART, "OPT EXP", BAR};
input multiplier = 1;
input onExpansion = yes;
input profiles = 2;
input valueAreaPercent = 70;

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 TICKSIZE:
    height = PricePerRow.TICKSIZE;
}

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 plotsDomain = IsNaN(close) == onExpansion;

plot POC = if plotsDomain then pc else Double.NaN;
 
@SleepyZ Hi, I'm wondering if you can help me with this ThinkScript question for Volume Profile POC? I'm not sure if it is possible...
My problem: I want my POC Line referencing the Monthly chart. To plot out the POC, I switch my chart to the 10-Day 30-Minute timeframe and manually plot the price level of the POC... The problem is, the POC seems to always be changing when I use a different timeframe, such as today's 5-minute chart. Every 30 days, a new POC will be established, and I always like to keep the prior's month POC manually plotted as well - - so I always have 2 Monthly-POC marked using the 10-Day 30-Minute timeframe.
My question: is it possible to edit this Volume Profile script to correctly show the Monthly-POC from the 10-Day 30-Minute timeframe, on all smaller timeframes I switch to?


Code:
input pricePerRowHeightMode = {default TICKSIZE};
input customRowHeight = 1.0;
input timePerProfile = {default MONTH, MINUTE, HOUR, DAY, WEEK, CHART, "OPT EXP", BAR};
input multiplier = 1;
input onExpansion = yes;
input profiles = 2;
input valueAreaPercent = 70;

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 TICKSIZE:
    height = PricePerRow.TICKSIZE;
}

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 plotsDomain = IsNaN(close) == onExpansion;

plot POC = if plotsDomain then pc else Double.NaN;

Regrettably, I am not aware that we have enough control of the volume profile indicator to do what you want.

I would suggest that you use at least a 30d chart timeframe to get better Monthly POC. TOS indicator's generally require the data to be on the chart to properly display in this case the Monthly data. See the attached image.

Capture.jpg
 
Last edited:
This study is designed to show POC of the day for every day, i would like for the POCs that have been tested, so if price has touched that level after it was plotted, not be there
and if possible the POCs that are untested be draw to extend to the right?
terrribly sorry if this is worded wrong or poorly

here is this code

#
# Quant Trading App Volume Profile
# Created: September 15, 2021
#
# Credit: Bryant Littrean, Thinkorswim
# Contact: [email protected]
# Trading Litt Youtube: https://bit.ly/trading-litt-yt
# Quant Trading App Discord: https://quanttradingdiscord.com
# 20220427 Sleepyz added timeperprofile for Day, Week, Month options
#

def multiplier = 1;def onExpansion = no;def profiles = 1000;input profileSession = {default Day, Week, Month};input showPointOfControl = yes;input showValueArea = yes;input valueAreaPercent = 68;input opacity = 60;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 (profileSession) {case DAY: period = countTradingDays(min(first(yyyymmdd), yyyymmdd), yyyymmdd) - 1;case WEEK: period = floor(day_number / 7);case MONTH: period = floor(month - first(month));}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 = PricePerRow.TICKSIZE;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", CreateColor(70, 70, 70));DefineGlobalColor("Point Of Control", CreateColor(255, 215, 0));DefineGlobalColor("Value Area", CreateColor(95, 140, 230));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);POC.SetLineWeight(1);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();
 
This study is designed to show POC of the day for every day, i would like for the POCs that have been tested, so if price has touched that level after it was plotted, not be there
and if possible the POCs that are untested be draw to extend to the right?
terrribly sorry if this is worded wrong or poorly

here is this code

#
# Quant Trading App Volume Profile
# Created: September 15, 2021
#
# Credit: Bryant Littrean, Thinkorswim
# Contact: [email protected]
# Trading Litt Youtube: https://bit.ly/trading-litt-yt
# Quant Trading App Discord: https://quanttradingdiscord.com
# 20220427 Sleepyz added timeperprofile for Day, Week, Month options
#

def multiplier = 1;def onExpansion = no;def profiles = 1000;input profileSession = {default Day, Week, Month};input showPointOfControl = yes;input showValueArea = yes;input valueAreaPercent = 68;input opacity = 60;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 (profileSession) {case DAY: period = countTradingDays(min(first(yyyymmdd), yyyymmdd), yyyymmdd) - 1;case WEEK: period = floor(day_number / 7);case MONTH: period = floor(month - first(month));}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 = PricePerRow.TICKSIZE;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", CreateColor(70, 70, 70));DefineGlobalColor("Point Of Control", CreateColor(255, 215, 0));DefineGlobalColor("Value Area", CreateColor(95, 140, 230));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);POC.SetLineWeight(1);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();

I did something similar to TPO and Volume Profiles on this site https://usethinkscript.com/threads/extend-point-of-control-line-volume-profile.10893/post-106420
 
any chance you could alert this study i have?this this has already been fine tuned to show a specific POC, i just want the tested pocs gone and untexted extended so i dont have to draw manually :)

The study you have doesn't have extended POCs that I can see from the code you posted. The code in the thread of the link that I provided does.
 
i maybe pushing my luck here, but is it possible to plot POC that was tested through "todays" or last session? possibly a different color?

The first 2 days if not touched will color the extended POC lines yellow instead of magenta as in the code below

Capture.jpg

Ruby:
#VolumeProfile_Extended_POCs_HVAs_LVAs_for_x_Daysback_and_Limited_Plots_when_crossed
#More can be added using the logic below
#Sleepyz - usethinkscript request @yardlay
#Added HVA * LVA Lines and Plot limit when crossed for all 3;

script v {
    input daysback = 1;
    def volp = reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE");
    def ymd  = GetYYYYMMDD();
    def y    = if ymd != ymd[1] then y[1] + 1 else y[1];
    def pc   = if IsNaN(close)
               then pc[1]
               else if y == HighestAll(y) - daysback
               then volp
               else pc[1];
    plot x    = if y > HighestAll(y) - daysback and
                (Between(pc, low, high) or close crosses pc)
                then BarNumber()
                else Double.NaN;

    plot poc = if IsNaN(LowestAll(x))
               then pc
               else if BarNumber() > LowestAll(x)
               then Double.NaN
               else pc;
}

DefineGlobalColor("H", Color.YELLOW);
DefineGlobalColor("L", Color.YELLOW);
DefineGlobalColor("P", Color.WHITE);
DefineGlobalColor("NB", Color.MAGENTA);

input shownakedonly = yes;
input start         = 0;

plot v1 = if shownakedonly and !IsNaN(LowestAll(v(1 + start).x)) then Double.NaN else v(1 + start).poc;
v1.AssignValueColor(if IsNaN(LowestAll(v(1 + start).x)) and start == 0 then Color.YELLOW else GlobalColor("P"));
v1.SetPaintingStrategy(PaintingStrategy.DASHES);
v1.SetLineWeight(2);

plot v2 =  if shownakedonly and !IsNaN(LowestAll(v(2 + start).x)) then Double.NaN else v(2 + start).poc;
v2.AssignValueColor(if IsNaN(LowestAll(v(2 + start).x)) and start == 0 then Color.YELLOW else GlobalColor("P"));
v2.SetPaintingStrategy(PaintingStrategy.DASHES);
v2.SetLineWeight(2);

plot v3 =  if shownakedonly and !IsNaN(LowestAll(v(3 + start).x)) then Double.NaN else v(3 + start).poc;
v3.AssignValueColor(if IsNaN(LowestAll(v(3 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v3.SetPaintingStrategy(PaintingStrategy.DASHES);
v3.SetLineWeight(2);

plot v4 =  if shownakedonly and !IsNaN(LowestAll(v(4 + start).x)) then Double.NaN else v(4 + start).poc;
v4.AssignValueColor(if IsNaN(LowestAll(v(4 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v4.SetPaintingStrategy(PaintingStrategy.DASHES);
v4.SetLineWeight(2);

plot v5 =  if shownakedonly and !IsNaN(LowestAll(v(5 + start).x)) then Double.NaN else v(5  + start).poc;
v5.AssignValueColor(if IsNaN(LowestAll(v(5 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v5.SetPaintingStrategy(PaintingStrategy.DASHES);
v5.SetLineWeight(2);

plot v6 =  if shownakedonly and !IsNaN(LowestAll(v(6 + start).x)) then Double.NaN else v(6 + start).poc;
v6.AssignValueColor(if IsNaN(LowestAll(v(6 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v6.SetPaintingStrategy(PaintingStrategy.DASHES);
v6.SetLineWeight(2);

plot v7 =  if shownakedonly and !IsNaN(LowestAll(v(7 + start).x)) then Double.NaN else v(7 + start).poc;
v7.AssignValueColor(if IsNaN(LowestAll(v(7 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v7.SetPaintingStrategy(PaintingStrategy.DASHES);
v7.SetLineWeight(2);

plot v8 =   if shownakedonly and !IsNaN(LowestAll(v(8 + start).x)) then Double.NaN else v(8 + start).poc;
v8.AssignValueColor(if IsNaN(LowestAll(v(8 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v8.SetPaintingStrategy(PaintingStrategy.DASHES);
v8.SetLineWeight(2);

plot v9 =  if shownakedonly and !IsNaN(LowestAll(v(9 + start).x)) then Double.NaN else v(9 + start).poc;
v9.AssignValueColor(if IsNaN(LowestAll(v(9 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v9.SetPaintingStrategy(PaintingStrategy.DASHES);
v9.SetLineWeight(2);

plot v10 =  if shownakedonly and !IsNaN(LowestAll(v(10 + start).x)) then Double.NaN else v(10 + start).poc;
v10.AssignValueColor(if IsNaN(LowestAll(v(10 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v10.SetPaintingStrategy(PaintingStrategy.DASHES);
v10.SetLineWeight(2);

plot v11 =  if shownakedonly and !IsNaN(LowestAll(v(11 + start).x)) then Double.NaN else v(11 + start).poc;
v11.AssignValueColor(if IsNaN(LowestAll(v(11 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v11.SetPaintingStrategy(PaintingStrategy.DASHES);
v11.SetLineWeight(2);

plot v12 =  if shownakedonly and !IsNaN(LowestAll(v(12 + start).x)) then Double.NaN else v(12 + start).poc;
v12.AssignValueColor(if IsNaN(LowestAll(v(12 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v12.SetPaintingStrategy(PaintingStrategy.DASHES);
v12.SetLineWeight(2);

plot v13 =  if shownakedonly and !IsNaN(LowestAll(v(13 + start).x)) then Double.NaN else v(13 + start).poc;
v13.AssignValueColor(if IsNaN(LowestAll(v(13 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v13.SetPaintingStrategy(PaintingStrategy.DASHES);
v13.SetLineWeight(2);

plot v14 =  if shownakedonly and !IsNaN(LowestAll(v(14 + start).x)) then Double.NaN else v(14 + start).poc;
v14.AssignValueColor(if IsNaN(LowestAll(v(14 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v14.SetPaintingStrategy(PaintingStrategy.DASHES);
v14.SetLineWeight(2);

plot v15 =  if shownakedonly and !IsNaN(LowestAll(v(15 + start).x)) then Double.NaN else v(15 + start).poc;
v15.AssignValueColor(if IsNaN(LowestAll(v(15 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v15.SetPaintingStrategy(PaintingStrategy.DASHES);
v15.SetLineWeight(2);

plot v16 =  if shownakedonly and !IsNaN(LowestAll(v(16 + start).x)) then Double.NaN else v(16 + start).poc;
v16.AssignValueColor(if IsNaN(LowestAll(v(16 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v16.SetPaintingStrategy(PaintingStrategy.DASHES);
v16.SetLineWeight(2);

plot v17 =  if shownakedonly and !IsNaN(LowestAll(v(17 + start).x)) then Double.NaN else v(17 + start).poc;
v17.AssignValueColor(if IsNaN(LowestAll(v(17 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v17.SetPaintingStrategy(PaintingStrategy.DASHES);
v17.SetLineWeight(2);

plot v18 =  if shownakedonly and !IsNaN(LowestAll(v(18 + start).x)) then Double.NaN else v(18 + start).poc;
v18.AssignValueColor(if IsNaN(LowestAll(v(18 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v18.SetPaintingStrategy(PaintingStrategy.DASHES);
v18.SetLineWeight(2);

plot v19 =  if shownakedonly and !IsNaN(LowestAll(v(19 + start).x)) then Double.NaN else v(19 + start).poc;
v19.AssignValueColor(if IsNaN(LowestAll(v(19 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v19.SetPaintingStrategy(PaintingStrategy.DASHES);
v19.SetLineWeight(2);

plot v20 =  if shownakedonly and !IsNaN(LowestAll(v(20 + start).x)) then Double.NaN else v(20 + start).poc;
v20.AssignValueColor(if IsNaN(LowestAll(v(20 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v20.SetPaintingStrategy(PaintingStrategy.DASHES);
v20.SetLineWeight(2);
;

plot v21 =  if shownakedonly and !IsNaN(LowestAll(v(21 + start).x)) then Double.NaN else v(21 + start).poc;
v21.AssignValueColor(if IsNaN(LowestAll(v(21 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v21.SetPaintingStrategy(PaintingStrategy.DASHES);
v21.SetLineWeight(2);

plot v22 =  if shownakedonly and !IsNaN(LowestAll(v(22 + start).x)) then Double.NaN else v(22 + start).poc;
v22.AssignValueColor(if IsNaN(LowestAll(v(22 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v22.SetPaintingStrategy(PaintingStrategy.DASHES);
v22.SetLineWeight(2);

plot v23 =  if shownakedonly and !IsNaN(LowestAll(v(23 + start).x)) then Double.NaN else v(23 + start).poc;
v23.AssignValueColor(if IsNaN(LowestAll(v(23 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v23.SetPaintingStrategy(PaintingStrategy.DASHES);
v23.SetLineWeight(2);

plot v24 =  if shownakedonly and !IsNaN(LowestAll(v(24 + start).x)) then Double.NaN else v(24 + start).poc;
v24.AssignValueColor(if IsNaN(LowestAll(v(24 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v24.SetPaintingStrategy(PaintingStrategy.DASHES);
v24.SetLineWeight(2);

plot v25 =  if shownakedonly and !IsNaN(LowestAll(v(25 + start).x)) then Double.NaN else v(25 + start).poc;
v25.AssignValueColor(if IsNaN(LowestAll(v(25 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v25.SetPaintingStrategy(PaintingStrategy.DASHES);
v25.SetLineWeight(2);

plot v26 =  if shownakedonly and !IsNaN(LowestAll(v(26 + start).x)) then Double.NaN else v(26 + start).poc;
v26.AssignValueColor(if IsNaN(LowestAll(v(26 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v26.SetPaintingStrategy(PaintingStrategy.DASHES);
v26.SetLineWeight(2);

plot v27 =  if shownakedonly and !IsNaN(LowestAll(v(27 + start).x)) then Double.NaN else v(27 + start).poc;
v7.AssignValueColor(if IsNaN(LowestAll(v(27 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v27.SetPaintingStrategy(PaintingStrategy.DASHES);
v27.SetLineWeight(2);

plot v28 =  if shownakedonly and !IsNaN(LowestAll(v(28 + start).x)) then Double.NaN else v(28 + start).poc;
v28.AssignValueColor(if IsNaN(LowestAll(v(28 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v28.SetPaintingStrategy(PaintingStrategy.DASHES);
v28.SetLineWeight(2);

plot v29 =  if shownakedonly and !IsNaN(LowestAll(v(29 + start).x)) then Double.NaN else v(29 + start).poc;
v29.AssignValueColor(if IsNaN(LowestAll(v(29 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v29.SetPaintingStrategy(PaintingStrategy.DASHES);
v29.SetLineWeight(2);

plot v30 =  if shownakedonly and !IsNaN(LowestAll(v(30 + start).x)) then Double.NaN else v(30 + start).poc;
v30.AssignValueColor(if IsNaN(LowestAll(v(30 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v30.SetPaintingStrategy(PaintingStrategy.DASHES);
v30.SetLineWeight(2);
;
 
Last edited:
Good evening everyone, can someone help me out with this code to implement to only show current day volume profile. When i want to use this with the DAY volume profile selected, you can still see yesterdays DAY volume profile. i think it would be cleaner to implement a toggle in the settings of the indicator to toggle show previous days (on/off). Thanks in advance!
 
Good evening everyone, can someone help me out with this code to implement to only show current day volume profile. When i want to use this with the DAY volume profile selected, you can still see yesterdays DAY volume profile. i think it would be cleaner to implement a toggle in the settings of the indicator to toggle show previous days (on/off). Thanks in advance!

There are two scripts used in that link. Here it is revised in the following link to what I think you wanted in the circle. https://tos.mx/BYlQibi
In study ....2755.. all that was done was to change this to 1 ... def profiles = 1;
In study ....2756... all plots v3..v30 were deleted.
 
There are two scripts used in that link. Here it is revised in the following link to what I think you wanted in the circle. https://tos.mx/BYlQibi
In study ....2755.. all that was done was to change this to 1 ... def profiles = 1;
In study ....2756... all plots v3..v30 were deleted.
Hey man is it possible to make this indicator accessible on mobile or even just the POC line? or is trying to get an indicator on mobile to complicated?
 
The first 2 days if not touched will color the extended POC lines yellow instead of magenta as in the code in this link http://tos.mx/z1bF554
Hello SleepyZ, I downloaded your NakedPOC indicator for use. First want to say thank you and much appreciated. However I'm not getting the yellow plot if the POC hasn't been touched within 2 days. Could you please advise on this? Also just one other quick question do you know of any customer volume profile indicator one could use. For instance if I wanted to do a volume profile for a specific number of days like the last 12 days. I see that it's been mentioned but I don't think anyone has come up with anything. thanks again.
 
Hello SleepyZ, I downloaded your NakedPOC indicator for use. First want to say thank you and much appreciated. However I'm not getting the yellow plot if the POC hasn't been touched within 2 days. Could you please advise on this? Also just one other quick question do you know of any customer volume profile indicator one could use. For instance if I wanted to do a volume profile for a specific number of days like the last 12 days. I see that it's been mentioned but I don't think anyone has come up with anything. thanks again.

The following code should paint the first 2 days POC yellow if the extended POC line is not touched. The links in the previous posts on this appear broken so I will edit them with this code instead.

As far as the custom12 days profile, you can choose DAY in the standard TOS VolumeProfile and set the multiplier to 12 to do that.

Screenshot-2022-10-28-051724.png
Ruby:
#VolumeProfile_Extended_POCs_HVAs_LVAs_for_x_Daysback_and_Limited_Plots_when_crossed
#More can be added using the logic below
#Sleepyz - usethinkscript request @yardlay
#Added HVA * LVA Lines and Plot limit when crossed for all 3;

script v {
    input daysback = 1;
    def volp = reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE");
    def ymd  = GetYYYYMMDD();
    def y    = if ymd != ymd[1] then y[1] + 1 else y[1];
    def pc   = if IsNaN(close)
               then pc[1]
               else if y == HighestAll(y) - daysback
               then volp
               else pc[1];
    plot x    = if y > HighestAll(y) - daysback and
                (Between(pc, low, high) or close crosses pc)
                then BarNumber()
                else Double.NaN;

    plot poc = if IsNaN(LowestAll(x))
               then pc
               else if BarNumber() > LowestAll(x)
               then Double.NaN
               else pc;
}

DefineGlobalColor("H", Color.YELLOW);
DefineGlobalColor("L", Color.YELLOW);
DefineGlobalColor("P", Color.WHITE);
DefineGlobalColor("NB", Color.MAGENTA);

input shownakedonly = yes;
input start         = 0;

plot v1 = if shownakedonly and !IsNaN(LowestAll(v(1 + start).x)) then Double.NaN else v(1 + start).poc;
v1.AssignValueColor(if IsNaN(LowestAll(v(1 + start).x)) and start == 0 then Color.YELLOW else GlobalColor("P"));
v1.SetPaintingStrategy(PaintingStrategy.DASHES);
v1.SetLineWeight(2);

plot v2 =  if shownakedonly and !IsNaN(LowestAll(v(2 + start).x)) then Double.NaN else v(2 + start).poc;
v2.AssignValueColor(if IsNaN(LowestAll(v(2 + start).x)) and start == 0 then Color.YELLOW else GlobalColor("P"));
v2.SetPaintingStrategy(PaintingStrategy.DASHES);
v2.SetLineWeight(2);

plot v3 =  if shownakedonly and !IsNaN(LowestAll(v(3 + start).x)) then Double.NaN else v(3 + start).poc;
v3.AssignValueColor(if IsNaN(LowestAll(v(3 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v3.SetPaintingStrategy(PaintingStrategy.DASHES);
v3.SetLineWeight(2);

plot v4 =  if shownakedonly and !IsNaN(LowestAll(v(4 + start).x)) then Double.NaN else v(4 + start).poc;
v4.AssignValueColor(if IsNaN(LowestAll(v(4 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v4.SetPaintingStrategy(PaintingStrategy.DASHES);
v4.SetLineWeight(2);

plot v5 =  if shownakedonly and !IsNaN(LowestAll(v(5 + start).x)) then Double.NaN else v(5  + start).poc;
v5.AssignValueColor(if IsNaN(LowestAll(v(5 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v5.SetPaintingStrategy(PaintingStrategy.DASHES);
v5.SetLineWeight(2);

plot v6 =  if shownakedonly and !IsNaN(LowestAll(v(6 + start).x)) then Double.NaN else v(6 + start).poc;
v6.AssignValueColor(if IsNaN(LowestAll(v(6 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v6.SetPaintingStrategy(PaintingStrategy.DASHES);
v6.SetLineWeight(2);

plot v7 =  if shownakedonly and !IsNaN(LowestAll(v(7 + start).x)) then Double.NaN else v(7 + start).poc;
v7.AssignValueColor(if IsNaN(LowestAll(v(7 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v7.SetPaintingStrategy(PaintingStrategy.DASHES);
v7.SetLineWeight(2);

plot v8 =   if shownakedonly and !IsNaN(LowestAll(v(8 + start).x)) then Double.NaN else v(8 + start).poc;
v8.AssignValueColor(if IsNaN(LowestAll(v(8 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v8.SetPaintingStrategy(PaintingStrategy.DASHES);
v8.SetLineWeight(2);

plot v9 =  if shownakedonly and !IsNaN(LowestAll(v(9 + start).x)) then Double.NaN else v(9 + start).poc;
v9.AssignValueColor(if IsNaN(LowestAll(v(9 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v9.SetPaintingStrategy(PaintingStrategy.DASHES);
v9.SetLineWeight(2);

plot v10 =  if shownakedonly and !IsNaN(LowestAll(v(10 + start).x)) then Double.NaN else v(10 + start).poc;
v10.AssignValueColor(if IsNaN(LowestAll(v(10 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v10.SetPaintingStrategy(PaintingStrategy.DASHES);
v10.SetLineWeight(2);

plot v11 =  if shownakedonly and !IsNaN(LowestAll(v(11 + start).x)) then Double.NaN else v(11 + start).poc;
v11.AssignValueColor(if IsNaN(LowestAll(v(11 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v11.SetPaintingStrategy(PaintingStrategy.DASHES);
v11.SetLineWeight(2);

plot v12 =  if shownakedonly and !IsNaN(LowestAll(v(12 + start).x)) then Double.NaN else v(12 + start).poc;
v12.AssignValueColor(if IsNaN(LowestAll(v(12 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v12.SetPaintingStrategy(PaintingStrategy.DASHES);
v12.SetLineWeight(2);

plot v13 =  if shownakedonly and !IsNaN(LowestAll(v(13 + start).x)) then Double.NaN else v(13 + start).poc;
v13.AssignValueColor(if IsNaN(LowestAll(v(13 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v13.SetPaintingStrategy(PaintingStrategy.DASHES);
v13.SetLineWeight(2);

plot v14 =  if shownakedonly and !IsNaN(LowestAll(v(14 + start).x)) then Double.NaN else v(14 + start).poc;
v14.AssignValueColor(if IsNaN(LowestAll(v(14 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v14.SetPaintingStrategy(PaintingStrategy.DASHES);
v14.SetLineWeight(2);

plot v15 =  if shownakedonly and !IsNaN(LowestAll(v(15 + start).x)) then Double.NaN else v(15 + start).poc;
v15.AssignValueColor(if IsNaN(LowestAll(v(15 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v15.SetPaintingStrategy(PaintingStrategy.DASHES);
v15.SetLineWeight(2);

plot v16 =  if shownakedonly and !IsNaN(LowestAll(v(16 + start).x)) then Double.NaN else v(16 + start).poc;
v16.AssignValueColor(if IsNaN(LowestAll(v(16 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v16.SetPaintingStrategy(PaintingStrategy.DASHES);
v16.SetLineWeight(2);

plot v17 =  if shownakedonly and !IsNaN(LowestAll(v(17 + start).x)) then Double.NaN else v(17 + start).poc;
v17.AssignValueColor(if IsNaN(LowestAll(v(17 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v17.SetPaintingStrategy(PaintingStrategy.DASHES);
v17.SetLineWeight(2);

plot v18 =  if shownakedonly and !IsNaN(LowestAll(v(18 + start).x)) then Double.NaN else v(18 + start).poc;
v18.AssignValueColor(if IsNaN(LowestAll(v(18 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v18.SetPaintingStrategy(PaintingStrategy.DASHES);
v18.SetLineWeight(2);

plot v19 =  if shownakedonly and !IsNaN(LowestAll(v(19 + start).x)) then Double.NaN else v(19 + start).poc;
v19.AssignValueColor(if IsNaN(LowestAll(v(19 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v19.SetPaintingStrategy(PaintingStrategy.DASHES);
v19.SetLineWeight(2);

plot v20 =  if shownakedonly and !IsNaN(LowestAll(v(20 + start).x)) then Double.NaN else v(20 + start).poc;
v20.AssignValueColor(if IsNaN(LowestAll(v(20 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v20.SetPaintingStrategy(PaintingStrategy.DASHES);
v20.SetLineWeight(2);
;

plot v21 =  if shownakedonly and !IsNaN(LowestAll(v(21 + start).x)) then Double.NaN else v(21 + start).poc;
v21.AssignValueColor(if IsNaN(LowestAll(v(21 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v21.SetPaintingStrategy(PaintingStrategy.DASHES);
v21.SetLineWeight(2);

plot v22 =  if shownakedonly and !IsNaN(LowestAll(v(22 + start).x)) then Double.NaN else v(22 + start).poc;
v22.AssignValueColor(if IsNaN(LowestAll(v(22 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v22.SetPaintingStrategy(PaintingStrategy.DASHES);
v22.SetLineWeight(2);

plot v23 =  if shownakedonly and !IsNaN(LowestAll(v(23 + start).x)) then Double.NaN else v(23 + start).poc;
v23.AssignValueColor(if IsNaN(LowestAll(v(23 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v23.SetPaintingStrategy(PaintingStrategy.DASHES);
v23.SetLineWeight(2);

plot v24 =  if shownakedonly and !IsNaN(LowestAll(v(24 + start).x)) then Double.NaN else v(24 + start).poc;
v24.AssignValueColor(if IsNaN(LowestAll(v(24 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v24.SetPaintingStrategy(PaintingStrategy.DASHES);
v24.SetLineWeight(2);

plot v25 =  if shownakedonly and !IsNaN(LowestAll(v(25 + start).x)) then Double.NaN else v(25 + start).poc;
v25.AssignValueColor(if IsNaN(LowestAll(v(25 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v25.SetPaintingStrategy(PaintingStrategy.DASHES);
v25.SetLineWeight(2);

plot v26 =  if shownakedonly and !IsNaN(LowestAll(v(26 + start).x)) then Double.NaN else v(26 + start).poc;
v26.AssignValueColor(if IsNaN(LowestAll(v(26 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v26.SetPaintingStrategy(PaintingStrategy.DASHES);
v26.SetLineWeight(2);

plot v27 =  if shownakedonly and !IsNaN(LowestAll(v(27 + start).x)) then Double.NaN else v(27 + start).poc;
v7.AssignValueColor(if IsNaN(LowestAll(v(27 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v27.SetPaintingStrategy(PaintingStrategy.DASHES);
v27.SetLineWeight(2);

plot v28 =  if shownakedonly and !IsNaN(LowestAll(v(28 + start).x)) then Double.NaN else v(28 + start).poc;
v28.AssignValueColor(if IsNaN(LowestAll(v(28 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v28.SetPaintingStrategy(PaintingStrategy.DASHES);
v28.SetLineWeight(2);

plot v29 =  if shownakedonly and !IsNaN(LowestAll(v(29 + start).x)) then Double.NaN else v(29 + start).poc;
v29.AssignValueColor(if IsNaN(LowestAll(v(29 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v29.SetPaintingStrategy(PaintingStrategy.DASHES);
v29.SetLineWeight(2);

plot v30 =  if shownakedonly and !IsNaN(LowestAll(v(30 + start).x)) then Double.NaN else v(30 + start).poc;
v30.AssignValueColor(if IsNaN(LowestAll(v(30 + start).x)) then GlobalColor("NB") else GlobalColor("P"));
v30.SetPaintingStrategy(PaintingStrategy.DASHES);
v30.SetLineWeight(2);
;
 
Last edited:
# Quant Trading App Volume Profile
# Created: September 15, 2021
#
# Credit: Bryant Littrean, Thinkorswim
# Contact: [email protected]
# Trading Litt Youtube: https://bit.ly/trading-litt-yt
# Quant Trading App Discord: https://quanttradingdiscord.com
# 20220427 Sleepyz added timeperprofile for Day, Week, Month options
#

def multiplier = 1;def onExpansion = no;def profiles = 1000;input profileSession = {default Day, Week, Month};input showPointOfControl = yes;input showValueArea = yes;input valueAreaPercent = 68;input opacity = 60;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 (profileSession) {case DAY: period = countTradingDays(min(first(yyyymmdd), yyyymmdd), yyyymmdd) - 1;case WEEK: period = floor(day_number / 7);case MONTH: period = floor(month - first(month));}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 = PricePerRow.TICKSIZE;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", CreateColor(70, 70, 70));DefineGlobalColor("Point Of Control", CreateColor(255, 215, 0));DefineGlobalColor("Value Area", CreateColor(95, 140, 230));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);POC.SetLineWeight(2);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();
 

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
327 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