Rec fuction ...recording previous Volume Profile POC

kblaine123

New member
Hello All....

IF i use this script, I can record the previous periods Volume profile POC

def pc = if IsNaN(vol.GetPointOfControl()) and con then pc[1] else vol.GetPointOfControl();
rec priorPOC = if period != period[1] then pc[1] else priorPOC[1] ;

What I need (would like to do) is to record the period before the previous period .....is there a script that can do this ?

Thanks
 
Solution
Hello All....

IF i use this script, I can record the previous periods Volume profile POC

def pc = if IsNaN(vol.GetPointOfControl()) and con then pc[1] else vol.GetPointOfControl();
rec priorPOC = if period != period[1] then pc[1] else priorPOC[1] ;

What I need (would like to do) is to record the period before the previous period .....is there a script that can do this ?

Thanks

Here are the last 3 POCs. More can be created with the same process.

Screenshot-2023-01-14-182849.png
Ruby:
def POC      = reference VolumeProfile("time per profile" = "DAY", "on expansion" = No);
def priorPOC = if POC[1]!=POC then POC[1] else priorPOC[1];
def nextPOC  = if priorPOC!=PriorPOC[1] then priorPOC[1] else nextPOC[1];

addlabel(1,"POC " + asdollars(POC)...
Hello All....

IF i use this script, I can record the previous periods Volume profile POC

def pc = if IsNaN(vol.GetPointOfControl()) and con then pc[1] else vol.GetPointOfControl();
rec priorPOC = if period != period[1] then pc[1] else priorPOC[1] ;

What I need (would like to do) is to record the period before the previous period .....is there a script that can do this ?

Thanks

Here are the last 3 POCs. More can be created with the same process.

Screenshot-2023-01-14-182849.png
Ruby:
def POC      = reference VolumeProfile("time per profile" = "DAY", "on expansion" = No);
def priorPOC = if POC[1]!=POC then POC[1] else priorPOC[1];
def nextPOC  = if priorPOC!=PriorPOC[1] then priorPOC[1] else nextPOC[1];

addlabel(1,"POC " + asdollars(POC) +"| Prior " + asdollars(priorPOC) + "| Next " + asdollars(nextPOC), color.yellow);
 
Solution
SleepyZ....

in your script below...it references Volume Profile.....do you know the script to reference TPO instead ? I've tried a couple things, but no success. Thanks in adance.

def POC = reference VolumeProfile("time per profile" = "DAY", "on expansion" = No);
def priorPOC = if POC[1]!=POC then POC[1] else priorPOC[1];
def nextPOC = if priorPOC!=PriorPOC[1] then priorPOC[1] else nextPOC[1];
 
SleepyZ....

in your script below...it references Volume Profile.....do you know the script to reference TPO instead ? I've tried a couple things, but no success. Thanks in adance.

def POC = reference VolumeProfile("time per profile" = "DAY", "on expansion" = No);
def priorPOC = if POC[1]!=POC then POC[1] else priorPOC[1];
def nextPOC = if priorPOC!=PriorPOC[1] then priorPOC[1] else nextPOC[1];

This should work

Ruby:
def POC = reference TPOProfile("time per profile" = "DAY", "on expansion" = No);
def priorPOC = if POC[1]!=POC then POC[1] else priorPOC[1];
def nextPOC = if priorPOC!=PriorPOC[1] then priorPOC[1] else nextPOC[1];
addlabel(1, POC+" "+priorpoc+" "+nextpoc, color.yellow);
 
This should work
SleepyZ - looking for enlightenment again. I use the below code to draw the last 30 VPOCs with extensions to the right based on the VolumeProfile "day" parameter - brute force / not elegant but works. I've tried modifying code to limit to RTH but unsuccessful. Seems like I should be able to incorporate an RTH cond for each of the "startNewProfile" profiles but does not work. Any suggestion appreciated or if you can point me to anything that simply just draws all RTH VPOCs extended to the right. Thanks as always






Ruby:
input daysback = 1;
input showonexpansion = no;

def ymd      = GetYYYYMMDD();
def candles  = !IsNaN(close);
def capture  = candles and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay  = (HighestAll(dayCount) - dayCount) ;

def vpoc      = if thisDay == daysback then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else vpoc[1];
def V1poc     = if thisDay == daysback + 1 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V1poc[1];
def V2poc     = if thisDay == daysback + 2 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V2poc[1];
def V3poc     = if thisDay == daysback + 3 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V3poc[1];
def V4poc     = if thisDay == daysback + 4 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V4poc[1];
def V5poc     = if thisDay == daysback + 5 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V5poc[1];
def V6poc     = if thisDay == daysback + 6 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V6poc[1];
def V7poc     = if thisDay == daysback + 7 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V7poc[1];
def V8poc     = if thisDay == daysback + 8 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V8poc[1];
def V9poc     = if thisDay == daysback + 9 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V9poc[1];
def V10poc     = if thisDay == daysback + 10 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V10poc[1];
def V11poc     = if thisDay == daysback + 11 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V11poc[1];
def V12poc     = if thisDay == daysback + 12 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V12poc[1];
def V13poc     = if thisDay == daysback + 13 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V13poc[1];
def V14poc     = if thisDay == daysback + 14 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V14poc[1];
def V15poc     = if thisDay == daysback + 15 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V15poc[1];
def V16poc     = if thisDay == daysback + 16 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V16poc[1];
def V17poc     = if thisDay == daysback + 17 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V17poc[1];
def V18poc     = if thisDay == daysback + 18 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V18poc[1];
def V19poc     = if thisDay == daysback + 19 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V19poc[1];
def V20poc     = if thisDay == daysback + 20 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V20poc[1];
def V21poc     = if thisDay == daysback + 21 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V21poc[1];
def V22poc     = if thisDay == daysback + 22 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V22poc[1];
def V23poc     = if thisDay == daysback + 23 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V23poc[1];
def V24poc     = if thisDay == daysback + 24 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V24poc[1];
def V25poc     = if thisDay == daysback + 25 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V25poc[1];
def V26poc     = if thisDay == daysback + 26 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V26poc[1];
def V27poc     = if thisDay == daysback + 27 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V27poc[1];
def V28poc     = if thisDay == daysback + 28 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V28poc[1];
def V29poc     = if thisDay == daysback + 29 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V29poc[1];
def V30poc     = if thisDay == daysback + 30 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V30poc[1];

plot vpoc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else vpoc;
plot V1poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 1 then Double.NaN else V1poc;
plot V2poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 2 then Double.NaN else V2poc;
plot V3poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 3 then Double.NaN else V3poc;
plot V4poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 4 then Double.NaN else V4poc;
plot V5poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 5 then Double.NaN else V5poc;
plot V6poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 6 then Double.NaN else V6poc;
plot V7poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 7 then Double.NaN else V7poc;
plot V8poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 8 then Double.NaN else V8poc;
plot V9poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 9 then Double.NaN else V9poc;
plot V10poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 10 then Double.NaN else V10poc;
plot V11poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 11 then Double.NaN else V11poc;
plot V12poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 12 then Double.NaN else V12poc;
plot V13poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 13 then Double.NaN else V13poc;
plot V14poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 14 then Double.NaN else V14poc;
plot V15poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 15 then Double.NaN else V15poc;
plot V16poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 16 then Double.NaN else V16poc;
plot V17poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 17 then Double.NaN else V17poc;
plot V18poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 18 then Double.NaN else V18poc;
plot V19poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 19 then Double.NaN else V19poc;
plot V20poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 20 then Double.NaN else V20poc;
plot V21poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 21 then Double.NaN else V21poc;
plot V22poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 22 then Double.NaN else V22poc;
plot V23poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 23 then Double.NaN else V23poc;
plot V24poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 24 then Double.NaN else V24poc;
plot V25poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 25 then Double.NaN else V25poc;
plot V26poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 26 then Double.NaN else V26poc;
plot V27poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 27 then Double.NaN else V27poc;
plot V28poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 28 then Double.NaN else V28poc;
plot V29poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 29 then Double.NaN else V29poc;
plot V30poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 30 then Double.NaN else V30poc;

vpoc1.SetDefaultColor(Color.Yellow);
v1poc1.SetDefaultColor(Color.Yellow);
v2poc1.SetDefaultColor(Color.Yellow);
v3poc1.SetDefaultColor(Color.Yellow);
v4poc1.SetDefaultColor(Color.Yellow);
v5poc1.SetDefaultColor(Color.Yellow);
v6poc1.SetDefaultColor(Color.Yellow);
v7poc1.SetDefaultColor(Color.Yellow);
v8poc1.SetDefaultColor(Color.Yellow);
v9poc1.SetDefaultColor(Color.Yellow);
v10poc1.SetDefaultColor(Color.Yellow);
v11poc1.SetDefaultColor(Color.Yellow);
v12poc1.SetDefaultColor(Color.Yellow);
v13poc1.SetDefaultColor(Color.Yellow);
v14poc1.SetDefaultColor(Color.Yellow);
v15poc1.SetDefaultColor(Color.Yellow);
v16poc1.SetDefaultColor(Color.Yellow);
v17poc1.SetDefaultColor(Color.Yellow);
v18poc1.SetDefaultColor(Color.Yellow);
v19poc1.SetDefaultColor(Color.Yellow);
v20poc1.SetDefaultColor(Color.Yellow);
v21poc1.SetDefaultColor(Color.Yellow);
v22poc1.SetDefaultColor(Color.Yellow);
v23poc1.SetDefaultColor(Color.Yellow);
v24poc1.SetDefaultColor(Color.Yellow);
v25poc1.SetDefaultColor(Color.Yellow);
v26poc1.SetDefaultColor(Color.Yellow);
v27poc1.SetDefaultColor(Color.Yellow);
v28poc1.SetDefaultColor(Color.Yellow);
v29poc1.SetDefaultColor(Color.Yellow);
v30poc1.SetDefaultColor(Color.Yellow);
 
SleepyZ - looking for enlightenment again. I use the below code to draw the last 30 VPOCs with extensions to the right based on the VolumeProfile "day" parameter - brute force / not elegant but works. I've tried modifying code to limit to RTH but unsuccessful. Seems like I should be able to incorporate an RTH cond for each of the "startNewProfile" profiles but does not work. Any suggestion appreciated or if you can point me to anything that simply just draws all RTH VPOCs extended to the right. Thanks as always






Ruby:
input daysback = 1;
input showonexpansion = no;

def ymd      = GetYYYYMMDD();
def candles  = !IsNaN(close);
def capture  = candles and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay  = (HighestAll(dayCount) - dayCount) ;

def vpoc      = if thisDay == daysback then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else vpoc[1];
def V1poc     = if thisDay == daysback + 1 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V1poc[1];
def V2poc     = if thisDay == daysback + 2 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V2poc[1];
def V3poc     = if thisDay == daysback + 3 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V3poc[1];
def V4poc     = if thisDay == daysback + 4 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V4poc[1];
def V5poc     = if thisDay == daysback + 5 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V5poc[1];
def V6poc     = if thisDay == daysback + 6 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V6poc[1];
def V7poc     = if thisDay == daysback + 7 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V7poc[1];
def V8poc     = if thisDay == daysback + 8 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V8poc[1];
def V9poc     = if thisDay == daysback + 9 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V9poc[1];
def V10poc     = if thisDay == daysback + 10 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V10poc[1];
def V11poc     = if thisDay == daysback + 11 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V11poc[1];
def V12poc     = if thisDay == daysback + 12 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V12poc[1];
def V13poc     = if thisDay == daysback + 13 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V13poc[1];
def V14poc     = if thisDay == daysback + 14 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V14poc[1];
def V15poc     = if thisDay == daysback + 15 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V15poc[1];
def V16poc     = if thisDay == daysback + 16 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V16poc[1];
def V17poc     = if thisDay == daysback + 17 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V17poc[1];
def V18poc     = if thisDay == daysback + 18 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V18poc[1];
def V19poc     = if thisDay == daysback + 19 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V19poc[1];
def V20poc     = if thisDay == daysback + 20 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V20poc[1];
def V21poc     = if thisDay == daysback + 21 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V21poc[1];
def V22poc     = if thisDay == daysback + 22 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V22poc[1];
def V23poc     = if thisDay == daysback + 23 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V23poc[1];
def V24poc     = if thisDay == daysback + 24 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V24poc[1];
def V25poc     = if thisDay == daysback + 25 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V25poc[1];
def V26poc     = if thisDay == daysback + 26 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V26poc[1];
def V27poc     = if thisDay == daysback + 27 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V27poc[1];
def V28poc     = if thisDay == daysback + 28 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V28poc[1];
def V29poc     = if thisDay == daysback + 29 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V29poc[1];
def V30poc     = if thisDay == daysback + 30 then reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE") else V30poc[1];

plot vpoc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else vpoc;
plot V1poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 1 then Double.NaN else V1poc;
plot V2poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 2 then Double.NaN else V2poc;
plot V3poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 3 then Double.NaN else V3poc;
plot V4poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 4 then Double.NaN else V4poc;
plot V5poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 5 then Double.NaN else V5poc;
plot V6poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 6 then Double.NaN else V6poc;
plot V7poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 7 then Double.NaN else V7poc;
plot V8poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 8 then Double.NaN else V8poc;
plot V9poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 9 then Double.NaN else V9poc;
plot V10poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 10 then Double.NaN else V10poc;
plot V11poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 11 then Double.NaN else V11poc;
plot V12poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 12 then Double.NaN else V12poc;
plot V13poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 13 then Double.NaN else V13poc;
plot V14poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 14 then Double.NaN else V14poc;
plot V15poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 15 then Double.NaN else V15poc;
plot V16poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 16 then Double.NaN else V16poc;
plot V17poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 17 then Double.NaN else V17poc;
plot V18poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 18 then Double.NaN else V18poc;
plot V19poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 19 then Double.NaN else V19poc;
plot V20poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 20 then Double.NaN else V20poc;
plot V21poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 21 then Double.NaN else V21poc;
plot V22poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 22 then Double.NaN else V22poc;
plot V23poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 23 then Double.NaN else V23poc;
plot V24poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 24 then Double.NaN else V24poc;
plot V25poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 25 then Double.NaN else V25poc;
plot V26poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 26 then Double.NaN else V26poc;
plot V27poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 27 then Double.NaN else V27poc;
plot V28poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 28 then Double.NaN else V28poc;
plot V29poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 29 then Double.NaN else V29poc;
plot V30poc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback + 30 then Double.NaN else V30poc;

vpoc1.SetDefaultColor(Color.Yellow);
v1poc1.SetDefaultColor(Color.Yellow);
v2poc1.SetDefaultColor(Color.Yellow);
v3poc1.SetDefaultColor(Color.Yellow);
v4poc1.SetDefaultColor(Color.Yellow);
v5poc1.SetDefaultColor(Color.Yellow);
v6poc1.SetDefaultColor(Color.Yellow);
v7poc1.SetDefaultColor(Color.Yellow);
v8poc1.SetDefaultColor(Color.Yellow);
v9poc1.SetDefaultColor(Color.Yellow);
v10poc1.SetDefaultColor(Color.Yellow);
v11poc1.SetDefaultColor(Color.Yellow);
v12poc1.SetDefaultColor(Color.Yellow);
v13poc1.SetDefaultColor(Color.Yellow);
v14poc1.SetDefaultColor(Color.Yellow);
v15poc1.SetDefaultColor(Color.Yellow);
v16poc1.SetDefaultColor(Color.Yellow);
v17poc1.SetDefaultColor(Color.Yellow);
v18poc1.SetDefaultColor(Color.Yellow);
v19poc1.SetDefaultColor(Color.Yellow);
v20poc1.SetDefaultColor(Color.Yellow);
v21poc1.SetDefaultColor(Color.Yellow);
v22poc1.SetDefaultColor(Color.Yellow);
v23poc1.SetDefaultColor(Color.Yellow);
v24poc1.SetDefaultColor(Color.Yellow);
v25poc1.SetDefaultColor(Color.Yellow);
v26poc1.SetDefaultColor(Color.Yellow);
v27poc1.SetDefaultColor(Color.Yellow);
v28poc1.SetDefaultColor(Color.Yellow);
v29poc1.SetDefaultColor(Color.Yellow);
v30poc1.SetDefaultColor(Color.Yellow);

This hopefully limits the poc to RTHrs. I have done the first two in the code below. I will leave the rest to you.

The image and link https://tos.mx/6Mhp25a show the code of the first two and a modified RTHrs volumeprofile extended per day I had coded previously.

Regrettably, TOS requires a plot for each fully extended line to the right edge. Brute force is the only choice I know on how to do this.

Screenshot-2023-01-22-084954.png
Ruby:
input daysback = 1;
input showonexpansion = no;
input begin  = 0930;
input end    = 1600;
def ymd      = GetYYYYMMDD();
def candles  = !IsNaN(close);
def capture  = candles and ymd != ymd[1];
def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0);
def thisDay  = (HighestAll(dayCount) - dayCount) ;
def na       = Double.NaN;
def rth      = SecondsFromTime(begin) >= 0 and SecondsTillTime(end) >= 0;
def cond = rth != rth[1];

profile vol   = VolumeProfile("startNewProfile" = cond and secondstilltime(end)>=0, "onExpansion" = no, "numberOfProfiles" = 1000, pricePerRow = PricePerRow.TICKSIZE);
def pca       = if IsNaN(vol.GetPointOfControl())   then pca[1] else vol.GetPointOfControl()[1];
def poc       = if !rth or IsNaN(close) then poc[1] else pca[1];
###########

def vpoc      = if thisDay == daysback and secondsFromTime(begin) >= 0 then poc else vpoc[1];
def V1poc     = if thisDay == daysback + 1 and secondsFromTime(begin) >= 0 then poc else v1poc[1];

plot vpoc1  = if showonexpansion and !IsNaN(close) or thisDay > daysback then Double.NaN else vpoc;
plot V1poc1   = if showonexpansion and !IsNaN(close) or thisDay > daysback + 1 then Double.NaN else V1poc;

vpoc1.SetDefaultColor(Color.Yellow);
v1poc1.SetDefaultColor(Color.Yellow);

vpoc1.setpaintingStrategy(paintingStrategy.HORIZONTAL);
v1poc1.setpaintingStrategy(paintingStrategy.HORIZONTAL);
 
Hello Sleepy...I really didn't want to bother you again, but I just can't figure out the coding to get the rest of my needs.

You gave me the (short form) coding below for POC and previous POC's....I'm grateful for that. What I would also like is to add the Value Area High and Low to the coding. I know its likely simple, but I've tried many variations but can't come up with something that gives me those. Any help would be awesome.



def POC = reference TPOProfile("time per profile" = "DAY", "on expansion" = No);
def priorPOC = if POC[1]!=POC then POC[1] else priorPOC[1];
def nextPOC = if priorPOC!=PriorPOC[1] then priorPOC[1] else nextPOC[1];
addlabel(1, POC+" "+priorpoc+" "+nextpoc, color.yellow);
 
Hello Sleepy...I really didn't want to bother you again, but I just can't figure out the coding to get the rest of my needs.

You gave me the (short form) coding below for POC and previous POC's....I'm grateful for that. What I would also like is to add the Value Area High and Low to the coding. I know its likely simple, but I've tried many variations but can't come up with something that gives me those. Any help would be awesome.



def POC = reference TPOProfile("time per profile" = "DAY", "on expansion" = No);
def priorPOC = if POC[1]!=POC then POC[1] else priorPOC[1];
def nextPOC = if priorPOC!=PriorPOC[1] then priorPOC[1] else nextPOC[1];
addlabel(1, POC+" "+priorpoc+" "+nextpoc, color.yellow);



Well.......I came up with this below and it works fine....BUT, I need it for a year. Unfortunately, I have no idea if there is a workaround to have it look at a year rather than a month, day, hour.

def poc = reference tpoProfile("price per row height mode" = "TICKSIZE", "time per profile" = "Month", "on expansion" = no, multiplier = 3).poc;
def vahigh = reference tpoProfile("price per row height mode" = "TICKSIZE", "time per profile" = "MONTH", "on expansion" = no, multiplier = 3).VAHigh;
def valow = reference tpoProfile("price per row height mode" = "TICKSIZE", "time per profile" = "MONTH", "on expansion" = no, multiplier = 3).VALow;

plot tpoc = poc[1];
plot tavahigh = vahigh[1];
plot tvalow = valow[1];
 
Well.......I came up with this below and it works fine....BUT, I need it for a year. Unfortunately, I have no idea if there is a workaround to have it look at a year rather than a month, day, hour.

def poc = reference tpoProfile("price per row height mode" = "TICKSIZE", "time per profile" = "Month", "on expansion" = no, multiplier = 3).poc;
def vahigh = reference tpoProfile("price per row height mode" = "TICKSIZE", "time per profile" = "MONTH", "on expansion" = no, multiplier = 3).VAHigh;
def valow = reference tpoProfile("price per row height mode" = "TICKSIZE", "time per profile" = "MONTH", "on expansion" = no, multiplier = 3).VALow;

plot tpoc = poc[1];
plot tavahigh = vahigh[1];
plot tvalow = valow[1];

I dug deeper and found this that you had posted on another thread. I changed the 3 to a 12 (see bold print below) and it works just fine, however, it seems to address only the previous calender year....is there a way to simply address the previous 365 days ? In other words more of a rolling 365 days ?

input pricePerRowHeightMode = {default AUTOMATIC, TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input timePerProfile = {CHART, MINUTE, HOUR, DAY, WEEK, MONTH, default QUARTER, "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);
def qtr = (GetMonth() - 1 ) % 12;
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 QUARTER:
period = qtr == 0 and qtr[1] != 0;
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 tpo = TimeProfile("startNewProfile" = cond, "onExpansion" = onExpansion, "numberOfProfiles" = profiles, "pricePerRow" = height, "value area percent" = valueAreaPercent);
def con = CompoundValue(1, onExpansion, no);
def pc = if IsNaN(tpo.GetPointOfControl()) and con then pc[1] else tpo.GetPointOfControl();
def hVA = if IsNaN(tpo.GetHighestValueArea()) and con then hVA[1] else tpo.GetHighestValueArea();
def lVA = if IsNaN(tpo.GetLowestValueArea()) and con then lVA[1] else tpo.GetLowestValueArea();

def hProfile = if IsNaN(tpo.GetHighest()) and con then hProfile[1] else tpo.GetHighest();
def lProfile = if IsNaN(tpo.GetLowest()) and con then lProfile[1] else tpo.GetLowest();
def plotsDomain = IsNaN(close) == onExpansion;

plot POC = if plotsDomain then pc else Double.NaN;
plot VAH = if plotsDomain then hVA else Double.NaN;
plot VAL = if plotsDomain then lVA else Double.NaN;

def poc1 = if POC != POC[1] then pc[1] else poc1[1];
#plot xpoc1 = poc1;
def vah1 = if VAH != VAH[1] then VAH[1] else vah1[1];
#plot xvah1 = vah1;
def val1 = if VAL != VAL[1] then VAL[1] else val1[1];
#plot xval1 = val1;

POC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAH.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
#xpoc1.SetPaintingStrategy(PaintingStrategy.DASHES);
#xvah1.SetPaintingStrategy(PaintingStrategy.DASHES);
#xval1.SetPaintingStrategy(PaintingStrategy.DASHES);
POC.SetDefaultColor(Color.RED);
VAH.SetDefaultColor(Color.YELLOW);
VAL.SetDefaultColor(Color.YELLOW);
#xpoc1.SetDefaultColor(Color.RED);
#xvah1.SetDefaultColor(Color.YELLOW);
#xval1.SetDefaultColor(Color.YELLOW);
 

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

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
422 Online
Create Post

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