#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;
#Added Price to Most Recent Naked Labels
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)
then BarNumber() else Double.NaN;
plot poc = if IsNaN(LowestAll(x))
then pc
else if BarNumber() > LowestAll(x)
then Double.NaN
else pc;
}
script vh {
input daysback = 1;
def volh = reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE").VAHigh;
def ymd = GetYYYYMMDD();
def y = if ymd != ymd[1] then y[1] + 1 else y[1];
def ph = if IsNaN(close)
then ph[1] else
if y == HighestAll(y) - daysback
then volh else
ph[1];
plot x = if y > HighestAll(y) - daysback and Between(ph, low, high)
then BarNumber() else Double.NaN;
plot hva = if IsNaN(LowestAll(x))
then ph
else if BarNumber() > LowestAll(x)
then Double.NaN
else ph;
}
script vl {
input daysback = 1;
def voll = reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE").VALow;
def ymd = GetYYYYMMDD();
def y = if ymd != ymd[1] then y[1] + 1 else y[1];
def pl = if IsNaN(close)
then pl[1] else
if y == HighestAll(y) - daysback
then voll else
pl[1];
plot x = if y > HighestAll(y) - daysback and Between(pl, low, high)
then BarNumber() else Double.NaN;
plot val = if IsNaN(LowestAll(x))
then pl
else if BarNumber() > LowestAll(x)
then Double.NaN
else pl;
}
DefineGlobalColor("H", Color.YELLOW);
DefineGlobalColor("L", Color.YELLOW);
DefineGlobalColor("P", Color.WHITE);
DefineGlobalColor("NB", Color.MAGENTA);
plot v1 = v(1).poc;
v1.AssignValueColor(if IsNaN(LowestAll(v(1).x)) then GlobalColor("NB") else GlobalColor("P"));
v1.SetPaintingStrategy(PaintingStrategy.DASHES);
v1.SetLineWeight(1);
plot v2 = v(2).poc;
v2.AssignValueColor(if IsNaN(LowestAll(v(2).x)) then GlobalColor("NB") else GlobalColor("P"));
v2.SetPaintingStrategy(PaintingStrategy.DASHES);
v2.SetLineWeight(1);
plot v3 = v(3).poc;
v3.AssignValueColor(if IsNaN(LowestAll(v(3).x)) then GlobalColor("NB") else GlobalColor("P"));
v3.SetPaintingStrategy(PaintingStrategy.DASHES);
v3.SetLineWeight(1);
plot v4 = v(4).poc;
v4.AssignValueColor(if IsNaN(LowestAll(v(4).x)) then GlobalColor("NB") else GlobalColor("P"));
v4.SetPaintingStrategy(PaintingStrategy.DASHES);
v4.SetLineWeight(1);
plot v5 = v(5).poc;
v5.AssignValueColor(if IsNaN(LowestAll(v(5).x)) then GlobalColor("NB") else GlobalColor("P"));
v5.SetPaintingStrategy(PaintingStrategy.DASHES);
v5.SetLineWeight(1);
plot v6 = v(6).poc;
v6.AssignValueColor(if IsNaN(LowestAll(v(6).x)) then GlobalColor("NB") else GlobalColor("P"));
v6.SetPaintingStrategy(PaintingStrategy.DASHES);
v6.SetLineWeight(1);
plot v7 = v(7).poc;
v7.AssignValueColor(if IsNaN(LowestAll(v(7).x)) then GlobalColor("NB") else GlobalColor("P"));
v7.SetPaintingStrategy(PaintingStrategy.DASHES);
v7.SetLineWeight(1);
plot v8 = v(8).poc;
v8.AssignValueColor(if IsNaN(LowestAll(v(8).x)) then GlobalColor("NB") else GlobalColor("P"));
v8.SetPaintingStrategy(PaintingStrategy.DASHES);
v8.SetLineWeight(1);
plot v9 = v(9).poc;
v9.AssignValueColor(if IsNaN(LowestAll(v(9).x)) then GlobalColor("NB") else GlobalColor("P"));
v9.SetPaintingStrategy(PaintingStrategy.DASHES);
v9.SetLineWeight(1);
plot v10 = v(10).poc;
v10.AssignValueColor(if IsNaN(LowestAll(v(10).x)) then GlobalColor("NB") else GlobalColor("P"));
v10.SetPaintingStrategy(PaintingStrategy.DASHES);
v10.SetLineWeight(1);
;
AddLabel(1, "Most Recent Naked --> POC: " +
if IsNaN(LowestAll(v(1).x)) then "V1: " + v1 else
if IsNaN(LowestAll(v(2).x)) then "V2: " + v2 else
if IsNaN(LowestAll(v(3).x)) then "V3: " + v3 else
if IsNaN(LowestAll(v(4).x)) then "V4: " + v4 else
if IsNaN(LowestAll(v(5).x)) then "V5: " + v5 else
if IsNaN(LowestAll(v(6).x)) then "V6: " + v6 else
if IsNaN(LowestAll(v(7).x)) then "V7: " + v7 else
if IsNaN(LowestAll(v(8).x)) then "V8: " + v8 else
if IsNaN(LowestAll(v(9).x)) then "V9: " + v9 else
if IsNaN(LowestAll(v(10).x)) then "V10: " + v10 else
"NO V", Color.YELLOW) ;
plot vh1 = vh(1).hva;
vh1.AssignValueColor(if IsNaN(LowestAll(vh(1).x)) then GlobalColor("NB") else GlobalColor("H"));
vh1.SetPaintingStrategy(PaintingStrategy.DASHES);
vh1.SetLineWeight(1);
plot vh2 = vh(2).hva;
vh2.AssignValueColor(if IsNaN(LowestAll(vh(2).x)) then GlobalColor("NB") else GlobalColor("H"));
vh2.SetPaintingStrategy(PaintingStrategy.DASHES);
vh2.SetLineWeight(1);
plot vh3 = vh(3).hva;
vh3.AssignValueColor(if IsNaN(LowestAll(vh(3).x)) then GlobalColor("NB") else GlobalColor("H"));
vh3.SetPaintingStrategy(PaintingStrategy.DASHES);
vh3.SetLineWeight(1);
plot vh4 = vh(4).hva;
vh4.AssignValueColor(if IsNaN(LowestAll(vh(4).x)) then GlobalColor("NB") else GlobalColor("H"));
vh4.SetPaintingStrategy(PaintingStrategy.DASHES);
vh4.SetLineWeight(1);
plot vh5 = vh(5).hva;
vh5.AssignValueColor(if IsNaN(LowestAll(vh(5).x)) then GlobalColor("NB") else GlobalColor("H"));
vh5.SetPaintingStrategy(PaintingStrategy.DASHES);
vh5.SetLineWeight(1);
plot vh6 = vh(6).hva;
vh6.AssignValueColor(if IsNaN(LowestAll(vh(6).x)) then GlobalColor("NB") else GlobalColor("H"));
vh6.SetPaintingStrategy(PaintingStrategy.DASHES);
vh6.SetLineWeight(1);
plot vh7 = vh(7).hva;
vh7.AssignValueColor(if IsNaN(LowestAll(vh(7).x)) then GlobalColor("NB") else GlobalColor("H"));
vh7.SetPaintingStrategy(PaintingStrategy.DASHES);
vh7.SetLineWeight(1);
plot vh8 = vh(8).hva;
vh8.AssignValueColor(if IsNaN(LowestAll(vh(8).x)) then GlobalColor("NB") else GlobalColor("H"));
vh8.SetPaintingStrategy(PaintingStrategy.DASHES);
vh8.SetLineWeight(1);
plot vh9 = vh(9).hva;
vh9.AssignValueColor(if IsNaN(LowestAll(vh(9).x)) then GlobalColor("NB") else GlobalColor("H"));
vh9.SetPaintingStrategy(PaintingStrategy.DASHES);
vh9.SetLineWeight(1);
plot vh10 = vh(10).hva;
vh10.AssignValueColor(if IsNaN(LowestAll(vh(10).x)) then GlobalColor("NB") else GlobalColor("H"));
vh10.SetPaintingStrategy(PaintingStrategy.DASHES);
vh10.SetLineWeight(1);
;
AddLabel(1, " VAH: " +
if IsNaN(LowestAll(vh(1).x)) then "VH1: " + vh1 else
if IsNaN(LowestAll(vh(2).x)) then "VH2: " + vh2 else
if IsNaN(LowestAll(vh(3).x)) then "VH3: " + vh3 else
if IsNaN(LowestAll(vh(4).x)) then "VH4: " + vh4 else
if IsNaN(LowestAll(vh(5).x)) then "VH5: " + vh5 else
if IsNaN(LowestAll(vh(6).x)) then "VH6: " + vh6 else
if IsNaN(LowestAll(vh(7).x)) then "VH7: " + vh7 else
if IsNaN(LowestAll(vh(8).x)) then "VH8: " + vh8 else
if IsNaN(LowestAll(vh(9).x)) then "VH9: " + vh9 else
if IsNaN(LowestAll(vh(10).x)) then "VH10: " + vh10 else
"NO VH", Color.WHITE) ;
plot vl1 = vl(1).val;
vl1.AssignValueColor(if IsNaN(LowestAll(vl(1).x)) then GlobalColor("NB") else GlobalColor("L"));
vl1.SetPaintingStrategy(PaintingStrategy.DASHES);
vl1.SetLineWeight(1);
plot vl2 = vl(2).val;
vl2.AssignValueColor(if IsNaN(LowestAll(vl(2).x)) then GlobalColor("NB") else GlobalColor("L"));
vl2.SetPaintingStrategy(PaintingStrategy.DASHES);
vl2.SetLineWeight(1);
plot vl3 = vl(3).val;
vl3.AssignValueColor(if IsNaN(LowestAll(vl(3).x)) then GlobalColor("NB") else GlobalColor("L"));
vl3.SetPaintingStrategy(PaintingStrategy.DASHES);
vl3.SetLineWeight(1);
plot vl4 = vl(4);
vl4.AssignValueColor(if IsNaN(LowestAll(vl(4).x)) then GlobalColor("NB") else GlobalColor("L"));
vl4.SetPaintingStrategy(PaintingStrategy.DASHES);
vl4.SetLineWeight(1);
plot vl5 = vl(5).val;
vl5.AssignValueColor(if IsNaN(LowestAll(vl(5).x)) then GlobalColor("NB") else GlobalColor("L"));
vl5.SetPaintingStrategy(PaintingStrategy.DASHES);
vl5.SetLineWeight(1);
plot vl6 = vl(6).val;
vl6.AssignValueColor(if IsNaN(LowestAll(vl(6).x)) then GlobalColor("NB") else GlobalColor("L"));
vl6.SetPaintingStrategy(PaintingStrategy.DASHES);
vl6.SetLineWeight(1);
plot vl7 = vl(7).val;
vl7.AssignValueColor(if IsNaN(LowestAll(vl(7).x)) then GlobalColor("NB") else GlobalColor("L"));
vl7.SetPaintingStrategy(PaintingStrategy.DASHES);
vl7.SetLineWeight(1);
plot vl8 = vl(8).val;
vl8.AssignValueColor(if IsNaN(LowestAll(vl(8).x)) then GlobalColor("NB") else GlobalColor("L"));
vl8.SetPaintingStrategy(PaintingStrategy.DASHES);
vl8.SetLineWeight(1);
plot vl9 = vl(9).val;
vl9.AssignValueColor(if IsNaN(LowestAll(vl(9).x)) then GlobalColor("NB") else GlobalColor("L"));
vl9.SetPaintingStrategy(PaintingStrategy.DASHES);
vl9.SetLineWeight(1);
plot vl10 = vl(10).val;
vl10.AssignValueColor(if IsNaN(LowestAll(vl(10).x)) then GlobalColor("NB") else GlobalColor("L"));
vl10.SetPaintingStrategy(PaintingStrategy.DASHES);
vl10.SetLineWeight(1);
;
AddLabel(1, " VAL: " +
if IsNaN(LowestAll(vl(1).x)) then "VL1: " + vl1 else
if IsNaN(LowestAll(vl(2).x)) then "VL2: " + vl2 else
if IsNaN(LowestAll(vl(3).x)) then "VL3: " + vl3 else
if IsNaN(LowestAll(vl(4).x)) then "VL4: " + vl4 else
if IsNaN(LowestAll(vl(5).x)) then "VL5: " + vl5 else
if IsNaN(LowestAll(vl(6).x)) then "VL6: " + vl6 else
if IsNaN(LowestAll(vl(7).x)) then "VL7: " + vl7 else
if IsNaN(LowestAll(vl(8).x)) then "VL8: " + vl8 else
if IsNaN(LowestAll(vl(9).x)) then "VL9: " + vl9 else
if IsNaN(LowestAll(vl(10).x)) then "VL10: " + vl10 else
"NO VL", Color.YELLOW) ;
input showbubbles = yes;
input bubblemover = 3;
def b = bubblemover;
def b1 = b + 1;
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), v1[b], "1P " + v1 , GlobalColor("P"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), v2[b], "2P " + v2 , GlobalColor("P"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), v3[b], "3P " + v3 , GlobalColor("P"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), v4[b], "4P " + v4 , GlobalColor("P"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), v5[b], "5P " + v5 , GlobalColor("P"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), v6[b], "6P " + v6 , GlobalColor("P"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), v7[b], "7P " + v7 , GlobalColor("P"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), v8[b], "8P " + v8 , GlobalColor("P"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), v9[b], "9P " + v9 , GlobalColor("P"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), v10[b], "10P " + v10 , GlobalColor("P"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vh1[b], "1H " + vh1 , GlobalColor("H"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vh2[b], "2H " + vh2 , GlobalColor("H"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vh3[b], "3H " + vh3 , GlobalColor("H"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vh4[b], "4H " + vh4 , GlobalColor("H"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vh5[b], "5H " + vh5 , GlobalColor("H"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vh6[b], "6H " + vh6 , GlobalColor("H"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vh7[b], "7H " + vh7 , GlobalColor("H"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vh8[b], "8H " + vh8 , GlobalColor("H"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vh9[b], "9H " + vh9 , GlobalColor("H"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vh10[b], "10H " + vh10 , GlobalColor("H"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vl1[b], "1L " + vl1 , GlobalColor("L"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vl2[b], "2L " + vl2 , GlobalColor("L"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vl3[b], "3L " + vl3 , GlobalColor("L"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vl4[b], "4L " + vl4 , GlobalColor("L"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vl5[b], "5L " + vl5 , GlobalColor("L"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vl6[b], "6L " + vl6 , GlobalColor("L"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vl7[b], "7L " + vl7 , GlobalColor("L"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vl8[b], "8L " + vl8 , GlobalColor("L"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vl9[b], "9L " + vl9 , GlobalColor("L"));
AddChartBubble(showbubbles and IsNaN(close[b]) and !IsNaN(close[b1]), vl10[b], "10L " + vl10 , GlobalColor("L"));
v1.HideBubble();
v2.HideBubble();
v3.HideBubble();
v4.HideBubble();
v5.HideBubble();
v6.HideBubble();
v7.HideBubble();
v8.HideBubble();
v9.HideBubble();
v10.HideBubble();
vh1.HideBubble();
vh2.HideBubble();
vh3.HideBubble();
vh4.HideBubble();
vh5.HideBubble();
vh6.HideBubble();
vh7.HideBubble();
vh8.HideBubble();
vh9.HideBubble();
vh10.HideBubble();
vl1.HideBubble();
vl2.HideBubble();
vl3.HideBubble();
vl4.HideBubble();
vl5.HideBubble();
vl6.HideBubble();
vl7.HideBubble();
vl8.HideBubble();
vl9.HideBubble();
vl10.HideBubble();