How to reference previous day VPOC, VAH, and VAL? - futures io
futures io futures trading

How to reference previous day VPOC, VAH, and VAL?

Discussion in ThinkOrSwim

    1. trending_up 1,414 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 1 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Search this Thread

How to reference previous day VPOC, VAH, and VAL?

(login for full post details)
  #1 (permalink)
Las Vegas, NV
Experience: Beginner
Platform: NinjaTrader 8
Trading: Emini ES
Posts: 9 since May 2020
Thanks: 2 given, 1 received

I have an indicator that shows the volume profile for each day, but I would like to access the previous day's VPOC, VAL, and VAH specifically so I can perform calculations to compare them to the current day. Could anyone help me figure out how to do this? Is it possible to specify a time period when using GetHighestValueArea() and GetPointOfControl()? Or would it require something more complicated?

This is the script I use for the daily volume profiles. I tried to see if I could modify the code to store the value of a specific day, but it's beyond my skill level.

input aggregationPeriod = AggregationPeriod.DAY;
input length = 1;
input displace = -1;
input showOnlyLastPeriod = no;

input pricePerRowHeightMode = {default AUTOMATIC, TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input timePerProfile = {default CHART, MINUTE, HOUR, DAY, WEEK, MONTH, "OPT EXP", BAR};
input multiplier = 1;
input onExpansion = yes;
input profiles = 1000;
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) {
height = PricePerRow.AUTOMATIC;
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();

#Added to find previous day point of control
def testpc = vol.getPointOfControl()[1];

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;

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;

#added label to show label
#addLabel(yes, POC[1] );

DefineGlobalColor("Profile", GetColor(1));
DefineGlobalColor("Point Of Control", GetColor(5));
DefineGlobalColor("Value Area", GetColor(8));"Profile"), if showPointOfControl then globalColor("Point Of Control") else color.current, if showValueArea then
#globalColor("Value Area") else color.current, opacity);
POC.SetDefaultColor(globalColor("Point Of Control"));
VAHigh.SetDefaultColor(globalColor("Value Area"));
VALow.SetDefaultColor(globalColor("Value Area"));

#addlabel(yes, testpc);

Started this thread Reply With Quote

Journal Challenge February 2021 results:
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(173 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(120 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(35 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
(login for full post details)
  #2 (permalink)
San Diego, CA
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
Posts: 31 since Mar 2019
Thanks: 4 given, 19 received

Look back works ok, but you need to specify enough bars to put you into yesterday to get the "previous" value (POC[400]). One way to capture yesterday is using a time condition (at 1800) for the first bar of the session, then get the value of the previous bar. It works in most cases, but seems buggy at the month boundary for some reason.

def previousPOC = if SecondsTillTime(1800) == 0 then POC[1] else previousPOC[1];
def previousVAHigh = if SecondsTillTime(1800) == 0 then VAHigh[1] else previousVAHigh[1];
def previousVALow = if SecondsTillTime(1800) == 0 then VALow[1] else previousVALow[1];

plot prevPOC = previousPOC;
plot prevVAH = previousVAHigh;
plot prevVAL = previousVALow;


Addlabel(yes, "pPOC: " + round(previousPOC, 0) + " POC: " + round(POC, 0), Color.CYAN);
Addlabel(yes, "pVAH: " + round(previousVAHigh, 0) + " VAH: " + round(VAHigh, 0), Color.CYAN);
Addlabel(yes, "pVAL: " + round(previousVALow, 0) + " VAL: " + round(VALow, 0), Color.CYAN);

Reply With Quote
(login for full post details)
  #3 (permalink)
Las Vegas, NV
Experience: Beginner
Platform: NinjaTrader 8
Trading: Emini ES
Posts: 9 since May 2020
Thanks: 2 given, 1 received

Thank you so much for the help. Unfortunately it doesn't seem to work. As you can see it plots the volume profile for the chart as a whole, not the previous day. =/

Started this thread Reply With Quote
(login for full post details)
  #4 (permalink)
San Diego, CA
Experience: Beginner
Platform: TOS, Sierra
Trading: Emini ES, Crude CL
Posts: 31 since Mar 2019
Thanks: 4 given, 19 received

Yea, I see in your screenshot the values are not changing at the correct time. Time conditions are very picky and hard to code for all situations. Its not clear what settings you're using to recreate the issue. Here's an example of ES, and the only issue i saw was on the month boundary.


Reply With Quote

futures io Trading Community Platforms and Indicators ThinkOrSwim > How to reference previous day VPOC, VAH, and VAL?

Last Updated on November 11, 2020

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Battlestations! Show us your trading desk - $1,500 in prizes!


Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only

Importance of Finding Your Own Way w/Adam Grimes

Elite only

New Challenge (TBD)


Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts