#Premarket_VolumeProfiles_Preset_Intraday_Times
input showlastprofileonly = yes;
def begin;
def end;
if GetAggregationPeriod() == AggregationPeriod.FOUR_MIN {
begin = 0400;
end = 0928;
} else if GetAggregationPeriod() == AggregationPeriod.HOUR {
begin = 0400;
end = 0900;
} else if GetAggregationPeriod() == AggregationPeriod.TWO_HOURS {
begin = 0300;
end = 0900;
} else if GetAggregationPeriod() == AggregationPeriod.FOUR_HOURS {
begin = 0100;
end = 0900;
} else {
begin = 0400;
end = 0930;
}
def sec1 = SecondsFromTime(begin);
def sec2 = SecondsFromTime(end);
def isTime1 = (sec1 >= 0 and sec1[1] < 0) or (sec1 < sec1[1] and sec1 >= 0);
def isTime2 = (sec2 >= 0 and sec2[1] < 0) or (sec2 < sec2[1] and sec2 >= 0);
def inRange = CompoundValue(1, if isTime1 then 1 else if isTime2 then 0 else inRange[1], 0);
def tradingzones = if inRange
then 1
else 0;
input pricePerRowHeightMode = { AUTOMATIC, default TICKSIZE};
input multiplier = 1;
input onExpansion = no;
input profiles = 1000;
input valueAreaPercent = 70;
def cond = tradingzones[1] != tradingzones;
def profilecount = if cond then profilecount[1] + 1 else profilecount[1];
def profiletoday = HighestAll(profilecount) - profilecount ;
def height;
switch (pricePerRowHeightMode) {
case AUTOMATIC:
height = PricePerRow.AUTOMATIC;
case TICKSIZE:
height = PricePerRow.TICKSIZE;
}
profile vol = VolumeProfile("startNewProfile" = cond, "onExpansion" = no, "numberOfProfiles" = profiles, "pricePerRow" = height, "value area percent" = valueAreaPercent);
def con = CompoundValue(1, onExpansion, no);
def pc = if IsNaN(close) then pc[1] else if IsNaN(vol.GetPointOfControl()) and con then pc[1] else if tradingzones == 1 then vol.GetPointOfControl() else pc[1];
def hVA = if IsNaN(close) then hVA[1] else if IsNaN(vol.GetHighestValueArea()) and con then hVA[1] else if tradingzones == 1 then vol.GetHighestValueArea() else hVA[1];
def lVA = if IsNaN(close) then lVA[1] else if IsNaN(vol.GetLowestValueArea()) and con then lVA[1] else if tradingzones == 1 then vol.GetLowestValueArea() else lVA[1];
plot POC = if showlastprofileonly and profiletoday > 1 then Double.NaN else pc;
plot VAHigh = if showlastprofileonly and profiletoday > 1 then Double.NaN else hVA;
plot VALow = if showlastprofileonly and profiletoday > 1 then Double.NaN else lVA;
DefineGlobalColor("Profile", GetColor(1));
DefineGlobalColor("Point Of Control", GetColor(5));
DefineGlobalColor("Value Area", GetColor(8));
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"));
input bubbles = yes;
input bubblemover = 0;
def b = bubblemover;
def b1 = b + 1;
AddChartBubble(bubbles and IsNaN(close[b]) and !IsNaN(close[b1]), POC[b1], "POC", POC.TakeValueColor());
AddChartBubble(bubbles and IsNaN(close[b]) and !IsNaN(close[b1]), VAHigh[b1], "VAH", VAHigh.TakeValueColor());
AddChartBubble(bubbles and IsNaN(close[b]) and !IsNaN(close[b1]), VALow[b1], "VAL", VALow.TakeValueColor(), no);
#