Code:

```
# plots POC, VAH and VAL for profiles starting at RTH Open and ending 1,2,3 etc bars later
# Not a realistic solution to the problem
# Nube
def bn = BarNumber();
def na = Double.NaN;
script TestPro {
input Start = 1;
input nBars = 3;
def bn = BarNumber();
def na = Double.NaN;
def EndBar = if bn == start + nBars
then bn else endBar[1];
def NewProfile = bn == start or
bn crosses above endBar;
profile testProfile = VolumeProfile("startNewProfile" = NewProfile
, "onExpansion" = no, "numberOfProfiles" = 1000, "pricePerRow" = TickSize(), "value area percent" = 68);
plot hva = if bn == EndBar
then testProfile.GetHighestValueArea()
else na;
plot lva = if bn == EndBar
then testProfile.GetLowestValueArea()
else na;
plot poc = if bn == EndBar
then testProfile.GetPointOfControl()
else na;
}
def RTHOpen = GetDay() == GetLastDay() &&
GetTime() crosses above
RegularTradingStart(GetYYYYMMDD());
def RTHBar = CompoundValue(1,
if RTHOpen
then bn
else RTHBar[1],0);
def hva =
if bn == RTHBar + 1 then TestPro(RTHBar,1).hva else
if bn == RTHBar + 2 then TestPro(RTHBar,2).hva else
if bn == RTHBar + 3 then TestPro(RTHBar,3).hva else
if bn == RTHBar + 4 then TestPro(RTHBar,4).hva else
if bn == RTHBar + 5 then TestPro(RTHBar,5).hva else
if bn == RTHBar + 6 then TestPro(RTHBar,6).hva else
if bn == RTHBar + 7 then TestPro(RTHBar,7).hva else
if bn == RTHBar + 8 then TestPro(RTHBar,8).hva else
if bn == RTHBar + 9 then TestPro(RTHBar,9).hva else
if bn == RTHBar + 10 then TestPro(RTHBar,10).hva else
if bn == RTHBar + 11 then TestPro(RTHBar,11).hva else
if bn == RTHBar + 12 then TestPro(RTHBar,12).hva else
if bn == RTHBar + 13 then TestPro(RTHBar,13).hva else
if bn == RTHBar + 14 then TestPro(RTHBar,14).hva else
na;
def lva =
if bn == RTHBar + 1 then TestPro(RTHBar,1).lva else
if bn == RTHBar + 2 then TestPro(RTHBar,2).lva else
if bn == RTHBar + 3 then TestPro(RTHBar,3).lva else
if bn == RTHBar + 4 then TestPro(RTHBar,4).lva else
if bn == RTHBar + 5 then TestPro(RTHBar,5).lva else
if bn == RTHBar + 6 then TestPro(RTHBar,6).lva else
if bn == RTHBar + 7 then TestPro(RTHBar,7).lva else
if bn == RTHBar + 8 then TestPro(RTHBar,8).lva else
if bn == RTHBar + 9 then TestPro(RTHBar,9).lva else
if bn == RTHBar + 10 then TestPro(RTHBar,10).lva else
if bn == RTHBar + 11 then TestPro(RTHBar,11).lva else
if bn == RTHBar + 12 then TestPro(RTHBar,12).lva else
if bn == RTHBar + 13 then TestPro(RTHBar,13).lva else
if bn == RTHBar + 14 then TestPro(RTHBar,14).lva else
na;
def poc =
if bn == RTHBar + 1 then TestPro(RTHBar,1).poc else
if bn == RTHBar + 2 then TestPro(RTHBar,2).poc else
if bn == RTHBar + 3 then TestPro(RTHBar,3).poc else
if bn == RTHBar + 4 then TestPro(RTHBar,4).poc else
if bn == RTHBar + 5 then TestPro(RTHBar,5).poc else
if bn == RTHBar + 6 then TestPro(RTHBar,6).poc else
if bn == RTHBar + 7 then TestPro(RTHBar,7).poc else
if bn == RTHBar + 8 then TestPro(RTHBar,8).poc else
if bn == RTHBar + 9 then TestPro(RTHBar,9).poc else
if bn == RTHBar + 10 then TestPro(RTHBar,10).poc else
if bn == RTHBar + 11 then TestPro(RTHBar,11).poc else
if bn == RTHBar + 12 then TestPro(RTHBar,12).poc else
if bn == RTHBar + 13 then TestPro(RTHBar,13).poc else
if bn == RTHBar + 14 then TestPro(RTHBar,14).poc else
na;
plot
LoVA = if bn > HighestAll(RTHBar)
then lva else na;
plot
HiVA = if bn > HighestAll(RTHBar)
then hva else na;
plot
PointOfControl = if bn > HighestAll(RTHBar)
then poc else na;
LoVA.SetDefaultColor(Color.Violet);
LoVA.SetStyle(Curve.Long_Dash);
LoVA.EnableApproximation();
HiVA.SetStyle(Curve.Long_Dash);
HiVA.SetDefaultColor(Color.Violet);
HiVA.EnableApproximation();
PointOfControl.SetDefaultColor(Color.Yellow);
PointOfControl.EnableApproximation();
```