Volume profile displaced

mbeig

New member
Does anyone know how to displace the volume profile? I am using the following code to plot monthly POC, HVA, and LVA but I would like to displace the profile by 1 month (i.e. last month's profile is plotted on the current month and current month's developing profile is plotted into the future). Would appreciate any creative helps, ideas in moving the levels forward 1 month.

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

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);

plot HighValue = vol.GetHighestValueArea();
plot PointControl = vol.GetPointOfControl();
plot LowValue = vol.GetLowestValueArea();

HighValue.SetDefaultColor(color.white);
PointControl.SetDefaultColor(color.white);
LowValue.SetDefaultColor(color.white);

HighValue.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PointControl.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LowValue.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
 
Solution
mbeig said:
Does anyone know how to displace the volume profile? I am using the following code to plot monthly POC, HVA, and LVA but I would like to displace the profile by 1 month (i.e. last month's profile is plotted on the current month and current month's developing profile is plotted into the future). Would appreciate any creative helps, ideas in moving the levels forward 1 month.

This is one method that should help display the POC/VAH/VAL as requested.

The image shows the testdata (actual volumeprofiles) and plots as requested to be displayed.
Set input showtestdata to NO to only display the requested POC/VAH/VAL.
To properly display the requested plots, make sure enough timeframe is displayed to show the...
The code to put a moving average forward or backward along the time axis of the chart is
Code:
input displace = 0;
Unsure if this will accomplish what you're looking for as I have not seen this done to anything as dynamic as volume profile, but in case you hadn't tried this yet, thought I'd share
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

@tradebyday There are some functions that accept a variable with a displaced value, Volume profile doesn't have an input that I can displace. This is also confusing for me as there is clearly a price aggregation that is being used as an input but it's not explicitly called in the list of inputs for Volume Profile. TimePerProfile is used to define the number of periods to use per profile, but I am unable to wrap my head around because displacing it won't change the number of bars per profile and won't displace the bars certainly Maybe a manual plot is the only option that's why I am looking for some of the more experienced members' help here.
 
Here is the one I use. I use Volume profiles on all my charts, including tick, 5 minutes, 30 minute, daily. The key is ratios 5 minute chart I use a hourly or daily profile, 30 minute chart = Weekly Profile, Daily = Month Profile. I don't know where I originally received this code, but I have done some modification. It also has Fibonacci extensions. Play around with the setting, but I think it produces the desired responses. I know that the future value area doesn't appear until close to the time of the profile. So, for a monthly profile, it will appear on my chart possibility 1 to 2 before end of month.

Code:
# Profile TPO & Volume
# Personal setting: 
# Profile Type = Volume
# price per row height mode = Ticksize
# custom row height =1.0
# time per profile = Month
# multiplier = 1 (does nothing)
# on expansion = No
# profiles = 444 ;  This is used to show home many profiles on your chart
# show point of control = Yes;  Do you want to show or not
# show value area  = Yes;  Do you want a value area
# show value area cloud = Yes; Do you want the value area shaded
# value area percents = 70;  What is the size of the value area, sometimes use 68.1
# show high low = Yes; do you want to show the high and low price of profile
# opacity = 5 ; Do you want the shading of the profile to see it or not.  I like 5 faint in background
# paint bars = Yes;  Do you want to paint the bars Green above value, Red below value or grey when in value
# show extension = No;  Do you want to show the Fibonacci extensions
# dynamic hide extension = Yes;
# show label = No;

input profileType = {default Volume, Time};
input pricePerRowHeightMode = {default Ticksize, Automatic, Custom};
input customRowHeight = 1.0;
input timePerProfile = {default Day, Week, MIN5, MIN50, DayTwo, Month, Year, Minute, Hour, Chart, "Opt Exp", Bar};
input multiplier = 1;
input onExpansion = No;
input profiles = 2;
input showPointOfControl = Yes;
input showValueArea = Yes;
input showValueAreaCloud = Yes;
input ValueAreaPercent = 70;
input ShowHighLow = Yes;
input opacity = 5;
input PaintBars = No;
input ShowExtensions = No;
input DynamicHideExtensions = Yes;
input ShowLabel = No;
def FibExt1 = 1.618;
def FibExt2 = 2.618;
def FibExt3 = 4.236;
def SE = ShowExtensions;
def ShowProfileValueAreaCloud = no;


def period;
def yyyymmdd = GetYYYYMMDD();
def seconds = SecondsFromTime(0);
def month = GetYear() * 12 + GetMonth();
def year = GetYear();
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 MIN5:
    period = Floor(seconds / 300 + day_number * 24);
case MIN50:
    period = Floor(seconds / 3000 + day_number * 24);
case Hour:
    period = Floor(seconds / 3600 + day_number * 24);
case Day:
    period = CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 1;
case DayTwo:
    period = 172800000;
#CountTradingDays(Min(First(yyyymmdd), yyyymmdd), yyyymmdd) - 2;
case Week:
    period = Floor(day_number / 7);
case Month:
    period = Floor(month - First(month));
case Year:
    period = Floor(year - First(year));
case "Opt Exp":
    period = exp_opt - First(exp_opt);
case Bar:
    period = BarNumber() - 1;
}


def CloseByPeriod = close(Period = timePerProfile)[-1];
def Openbyperiod  = open(Period = timePerProfile)[-1];
def NewDay = if !IsNaN(CloseByPeriod) then 0 else 1;

rec Count = if period != period[1] then (Count[1] + period - period[1]) % 1 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;
case Custom:
    height = customRowHeight;
}

profile VOL = 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);

def con = CompoundValue(1, onExpansion, no);
rec pc = if IsNaN(VOL.GetPointOfControl()) and con then pc[1] else VOL.GetPointOfControl();
rec hVA = if IsNaN(VOL.GetHighestValueArea()) and con then hVA[1] else VOL.GetHighestValueArea();
rec lVA = if IsNaN(VOL.GetLowestValueArea()) and con then lVA[1] else VOL.GetLowestValueArea();
rec HVA_Last = if period == period[1] then HVA_Last[1] else hVA[1];
rec PC_Last  = if period == period[1] then PC_Last[1]  else pc[1];
rec LVA_Last = if period == period[1] then LVA_Last[1] else lVA[1];
rec hProfile = if IsNaN(VOL.GetHighest()) and con then hProfile[1] else VOL.GetHighest();
rec lProfile = if IsNaN(VOL.GetLowest()) and con then lProfile[1] else VOL.GetLowest();
def plotsDomain = IsNaN(close) == onExpansion;

rec hP_Last = if period == period[1] then hP_Last[1] else hProfile[1];
rec lP_Last = if period == period[1] then lP_Last[1] else lProfile[1];


plot VAH  = if !showValueArea then Double.NaN else HVA_Last[0];
plot POC  = PC_Last[0];
plot VAL  = if !showValueArea then Double.NaN else LVA_Last[0];
plot High = if !ShowHighLow then Double.NaN else hP_Last[0];
plot Low = if !ShowHighLow then Double.NaN else lP_Last[0];
#plot p = VOL.getPointOfControl();


DefineGlobalColor("Profile", GetColor(7));
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 ShowProfileValueAreaCloud then GlobalColor("Value Area") else Color.CURRENT, opacity);

POC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
POC.SetDefaultColor(Color.DARK_GRAY);
#POC.SetDefaultColor(CreateColor(32,49,57));
POC.SetLineWeight(1);
POC.HideTitle();

VAH.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAH.SetDefaultColor(Color.DARK_GREEN);
VAH.SetLineWeight(1);
VAH.HideBubble();
VAH.HideTitle();

VAL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAL.SetDefaultColor(Color.DARK_RED);
VAL.SetLineWeight(1);
VAL.HideBubble();
VAL.HideTitle();

High.SetPaintingStrategy(PaintingStrategy.DASHES);
High.SetDefaultColor(CreateColor(38, 38, 8));
High.SetLineWeight(1);
High.HideBubble();
High.HideTitle();

Low.SetPaintingStrategy(PaintingStrategy.DASHES);
Low.SetDefaultColor(CreateColor(38, 38, 8));
Low.SetLineWeight(1);
Low.HideBubble();
Low.HideTitle();
#################### Paint Bars #######################

AssignPriceColor(if !PaintBars then Color.CURRENT else if open >= VAH and close >= VAH then Color.GREEN else if open <= VAL and close <= VAL then Color.RED else Color.GRAY);
#################### Value Area Cloud #######################
#DefineGlobalColor("Value Area Cloud", (CreateColor(20, 20, 20)));
DefineGlobalColor("Value Area Cloud", Color.DARK_GRAY);
#DefineGlobalColor("Value Area Cloud", Color.WHITE);
def cloudhigh = if showValueAreaCloud then HVA_Last else Double.NaN;
def cloudlow  = if showValueAreaCloud then LVA_Last else Double.NaN;
AddCloud (cloudhigh, cloudlow, GlobalColor("Value Area Cloud"));
#################### Chart Label #######################

def InsideValueArea = close < HVA_Last and close > LVA_Last;
def BelowValue = close < LVA_Last;

AddLabel(ShowLabel, close, if InsideValueArea then Color.GRAY else if BelowValue then Color.RED else Color.GREEN);
#################### Fibonacci Extensions #######################

def VAWidth = High - Low;

plot E1H = if SE < 1 then Double.NaN else High + VAWidth * (FibExt1 - 1);
E1H.SetHiding(DynamicHideExtensions and close < VAH);
E1H.SetDefaultColor(CreateColor(0, 51, 0));
E1H.SetPaintingStrategy(PaintingStrategy.DASHES);
E1H.SetLineWeight(1);
E1H.HideBubble();
E1H.HideTitle();
plot E1L = if SE < 1 then Double.NaN else Low - VAWidth * (FibExt1 - 1);
E1L.SetHiding(DynamicHideExtensions and close > VAL);
E1L.SetDefaultColor(CreateColor(51, 0, 0));
E1L.SetPaintingStrategy(PaintingStrategy.DASHES);
E1L.SetLineWeight(1);
E1L.HideBubble();
E1L.HideTitle();

plot E2H = if SE < 1 then Double.NaN else High + VAWidth * (FibExt2 - 1);
E2H.SetHiding(DynamicHideExtensions and close < E1H);
E2H.SetDefaultColor(CreateColor(0, 51, 0));
E2H.SetPaintingStrategy(PaintingStrategy.DASHES);
E2H.SetLineWeight(1);
E2H.HideBubble();
E2H.HideTitle();
plot E2L = if SE < 1 then Double.NaN else Low - VAWidth * (FibExt2 - 1);
E2L.SetHiding(DynamicHideExtensions and close > E1L);
E2L.SetDefaultColor(CreateColor(51, 0, 0));
E2L.SetPaintingStrategy(PaintingStrategy.DASHES);
E2L.SetLineWeight(1);
E2L.HideBubble();
E2L.HideTitle();

plot E3H = if SE < 1 then Double.NaN else High + VAWidth * (FibExt3 - 1);
E3H.SetHiding(DynamicHideExtensions and close < E2H);
E3H.SetDefaultColor(CreateColor(0, 51, 0));
E3H.SetPaintingStrategy(PaintingStrategy.DASHES);
E3H.SetLineWeight(1);
E3H.HideBubble();
E3H.HideTitle();
plot E3L = if SE < 1 then Double.NaN else Low - VAWidth * (FibExt3 - 1);
E3L.SetHiding(DynamicHideExtensions and close > E2L);
E3L.SetDefaultColor(CreateColor(51, 0, 0));
E3L.SetPaintingStrategy(PaintingStrategy.DASHES);
E3L.SetLineWeight(1);
E3L.HideBubble();
E3L.HideTitle();
 
Does anyone know how to displace the volume profile? I am using the following code to plot monthly POC, HVA, and LVA but I would like to displace the profile by 1 month (i.e. last month's profile is plotted on the current month and current month's developing profile is plotted into the future). Would appreciate any creative helps, ideas in moving the levels forward 1 month.

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

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);

plot HighValue = vol.GetHighestValueArea();
plot PointControl = vol.GetPointOfControl();
plot LowValue = vol.GetLowestValueArea();

HighValue.SetDefaultColor(color.white);
PointControl.SetDefaultColor(color.white);
LowValue.SetDefaultColor(color.white);

HighValue.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
PointControl.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LowValue.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
did you ever figure out a way?
 
mbeig said:
Does anyone know how to displace the volume profile? I am using the following code to plot monthly POC, HVA, and LVA but I would like to displace the profile by 1 month (i.e. last month's profile is plotted on the current month and current month's developing profile is plotted into the future). Would appreciate any creative helps, ideas in moving the levels forward 1 month.

This is one method that should help display the POC/VAH/VAL as requested.

The image shows the testdata (actual volumeprofiles) and plots as requested to be displayed.
Set input showtestdata to NO to only display the requested POC/VAH/VAL.
To properly display the requested plots, make sure enough timeframe is displayed to show the following month beyond the current month.
This code is set to only work on montly settings as requested.
Screenshot 2023-07-23 091818.jpg
Code:
#Plot_Current_VolProfile_POC_VAH_VAL_on_Next_and_Prior_on_Current
#Sleepyzzz - usethinkscript request


script vp {
    input daysback = 1;
    def volp = reference VolumeProfile("time per profile" = "MONTH", "on expansion" = no, "price per row height mode" = "TICKSIZE");
    def ymd  = GetMonth();
    def y    = if !isnan(close) and ymd != ymd[1] then y[1] + 1 else y[1];
    def pc   = if IsNaN(close)
                  then pc[1] else
               if y == HighestAll(y) - daysback + 1
                  then volp  else
               pc[1];
    plot poc = pc;

}

script vh {
    input daysback = 1;
    def volp = reference VolumeProfile("time per profile" = "MONTH", "on expansion" = no, "price per row height mode" = "TICKSIZE").VAHigh;
    def ymd  = GetMonth();
    def y    = if !isnan(close) and ymd != ymd[1] then y[1] + 1 else y[1];
    def pc   = if IsNaN(close)
                  then pc[1] else
               if y == HighestAll(y) - daysback + 1
                  then volp  else
               pc[1];
    plot vah = pc;

}

script vl {
    input daysback = 1;
    def volp = reference VolumeProfile("time per profile" = "MONTH", "on expansion" = no, "price per row height mode" = "TICKSIZE").VALow;
    def ymd  = GetMonth();
    def y    = if !isnan(close) and ymd != ymd[1] then y[1] + 1 else y[1];
    def pc   = if IsNaN(close)
                  then pc[1] else
               if y == HighestAll(y) - daysback + 1
                  then volp  else
               pc[1];
    plot val = pc;

}

plot p1 =  if getmonth()==getlastmonth() then double.nan else vp(1).poc;
p1.SetDefaultColor(Color.RED);
p1.SetPaintingStrategy(PaintingStrategy.DASHES);
p1.SetLineWeight(2);

plot p2 =  if getmonth()!=getlastmonth() then double.nan else vp(2).poc;
p2.SetDefaultColor(Color.RED);
p2.SetPaintingStrategy(PaintingStrategy.DASHES);
p2.SetLineWeight(2);

plot h1 =  if getmonth()==getlastmonth() then double.nan else vh(1).vah;
h1.SetDefaultColor(Color.yellow);
h1.SetPaintingStrategy(PaintingStrategy.DASHES);
h1.SetLineWeight(2);

plot h2 =  if getmonth()!=getlastmonth() then double.nan else vh(2).vah;
h2.SetDefaultColor(Color.yellow);
h2.SetPaintingStrategy(PaintingStrategy.DASHES);
h2.SetLineWeight(2);

plot l1 =  if getmonth()==getlastmonth() then double.nan else vl(1).val;
l1.SetDefaultColor(Color.yellow);
l1.SetPaintingStrategy(PaintingStrategy.DASHES);
l1.SetLineWeight(2);

plot l2 =  if getmonth()!=getlastmonth() then double.nan else vl(2).val;
l2.SetDefaultColor(Color.yellow);
l2.SetPaintingStrategy(PaintingStrategy.DASHES);
l2.SetLineWeight(2);

#Volumeprofile script with Defaults to match extended POC plots x daysback
#
# TD Ameritrade IP Company, Inc. (c) 2010-2022
#
input showtestdata = yes;
input pricePerRowHeightMode = {AUTOMATIC, default TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input timePerProfile = {CHART, MINUTE, HOUR, default DAY, WEEK, MONTH, "OPT EXP", BAR};
input multiplier = 1;
input onExpansion = no;
input profiles = 2;
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 and showtestdata;

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 showtestdata and showValueArea then GlobalColor("Value Area") else Color.CURRENT,  if showtestdata then opacity else 0);
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();
 
Solution

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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