Previous day's POC, VAH, and VAL

shakib3585

Active member
VIP
Hello All,

Borrowing from @FutureTony's
https://usethinkscript.com/threads/naked-poc-finder-for-thinkorswim.8215/


I am trying to work with a label on a 3-minute aggregation period that shows the active closing price of the current day has crossed the Value Area High of the previous day. I have tried to create a label, as attached, but seems not working correctly even though I see the close price has already crossed the previous day Value Area High. Please help.

Thanks
Code:
rec count1 = CompoundValue(1, if !(GetDay() != GetDay()[1]) then count1[1] + 1 else 1, 1);
def priorperiod = if IsNaN(count1[1]) then 1 else Max(count1, count1[1]);
profile vol1 = volumeProfile("startNewProfile" = GetDay()!= GetDay()[1], "onExpansion" = no);

def vahprior = vol1.GetHighestValueArea();
def pocprior = vol1.GetPointOfControl();
def valprior = vol1.GetLowestValueArea();


def cl =close(period=aggregationperiod.day);

AddLabel(yes,"PVAH", if cl>vahprior then color.green else color.red);
AddLabel(yes,"PPOC", if cl>pocprior then color.green else color.red);
AddLabel(yes,"PVAL", if cl>valprior then color.green else color.red);
 
Last edited by a moderator:
Hello All,

I am trying to work with a label on a 3-minute aggregation period that shows the active closing price of the current day has crossed the Value Area High of the previous day. I have tried to create a label, as attached, but seems not working correctly even though I see the close price has already crossed the previous day Value Area High. Please help.

Thanks
Code:
rec count1 = CompoundValue(1, if !(GetDay() != GetDay()[1]) then count1[1] + 1 else 1, 1);
def priorperiod = if IsNaN(count1[1]) then 1 else Max(count1, count1[1]);
profile vol1 = volumeProfile("startNewProfile" = GetDay()!= GetDay()[1], "onExpansion" = no);

def vahprior = vol1.GetHighestValueArea();
def pocprior = vol1.GetPointOfControl();
def valprior = vol1.GetLowestValueArea();


def cl =close(period=aggregationperiod.day);

AddLabel(yes,"PVAH", if cl>vahprior then color.green else color.red);
AddLabel(yes,"PPOC", if cl>pocprior then color.green else color.red);
AddLabel(yes,"PVAL", if cl>valprior then color.green else color.red);

This should work by isolating the prior values and recursively saving those values to compare them to today's close.

Screenshot 2023-09-06 095435.png
Code:
rec count1 = CompoundValue(1, if !(GetDay() != GetDay()[1]) then count1[1] + 1 else 1, 1);
def priorperiod = if IsNaN(count1[1]) then 1 else Max(count1, count1[1]);
profile vol1 = VolumeProfile("startNewProfile" = GetDay() != GetDay()[1], "onExpansion" = no);

def vahprior = if GetDay() == GetLastDay() - 1 then vol1.GetHighestValueArea() else vahprior[1];
def pocprior = if GetDay() == GetLastDay() - 1 then vol1.GetPointOfControl() else pocprior[1];
def valprior = if GetDay() == GetLastDay() - 1 then vol1.GetLowestValueArea() else valprior[1];


def cl = close(period = AggregationPeriod.DAY);

AddLabel(yes, "PVAH", if cl > vahprior then Color.GREEN else Color.RED);
AddLabel(yes, "PPOC", if cl > pocprior then Color.GREEN else Color.RED);
AddLabel(yes, "PVAL", if cl > valprior then Color.GREEN else Color.RED);
 
Last edited:
thank you @SleepyZ . Can this study be used as scan criteria for a 3 minute aggregation

You can try something like the following, preferably run on or after the market opens, as the close(period=aggregationperiod.day) cannot be used in the scan on an intraday timeframe. A substitute for the rthrs close is included instead.

Code:
rec count1 = CompoundValue(1, if !(GetDay() != GetDay()[1]) then count1[1] + 1 else 1, 1);
def priorperiod = if IsNaN(count1[1]) then 1 else Max(count1, count1[1]);
profile vol1 = VolumeProfile("startNewProfile" = GetDay() != GetDay()[1], "onExpansion" = no);

def vahprior = if GetDay() == GetLastDay() - 1 then vol1.GetHighestValueArea() else vahprior[1];
def rth = getday() == getlastday() and secondsFromTime(0930)>=0 and secondstillTime(1600)>0;
def cl = if rth then close else cl[1];
plot scan = cl crosses vahprior;
 
You can try something like the following, preferably run on or after the market opens, as the close(period=aggregationperiod.day) cannot be used in the scan on an intraday timeframe. A substitute for the rthrs close is included instead.
should I use it on 3 minute or, daily aggregation. Also, the plot shows at current days only, is it possible to all other previous days
 
Last edited:
Hello All,

Borrowing from @FutureTony's
https://usethinkscript.com/threads/naked-poc-finder-for-thinkorswim.8215/

I am trying to plot the previous day VAH, VAL, POC with the code attached but it only plots for the current day. Please help to make this code plot for all other days.

Thanks
Code:
rec count1 = CompoundValue(1, if !(GetDay() != GetDay()[1]) then count1[1] + 1 else 1, 1);
def priorperiod = if IsNaN(count1[1]) then 1 else Max(count1, count1[1]);
profile vol1 = VolumeProfile("startNewProfile" = GetDay() != GetDay()[1], "onExpansion" = no);

def vahprior = if GetDay() == GetLastDay() - 1 then vol1.GetHighestValueArea() else vahprior[1];
def pocprior = if GetDay() == GetLastDay() - 1 then vol1.GetPointOfControl() else pocprior[1];
def valprior = if GetDay() == GetLastDay() - 1 then vol1.GetLowestValueArea() else valprior[1];


plot vahprev = GetValue(vahprior, priorperiod);
vahprev.SetDefaultColor(Color.red);
vahprev.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HORIZONTAL);
vahprev.SetLineWeight(1);
vahprev.HideBubble();

plot pocprev = GetValue(pocprior, priorperiod);
pocprev.SetDefaultColor(Color.white);
pocprev.SetPaintingStrategy(PaintingStrategy.POINTS);
pocprev.SetLineWeight(1);
pocprev.HideBubble();

plot valprev = GetValue(valprior, priorperiod);
valprev.SetDefaultColor(Color.green);
valprev.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HORIZONTAL);
valprev.SetLineWeight(1);
valprev.HideBubble();

Addlabel (yes, "PHVA ” +vahprev, color.red);
Addlabel (yes, "PPOC ” +pocprev, color.white);
Addlabel (yes, "PLVA ” +valprev, color.green);
 
Last edited by a moderator:
Change the 3 definition lines to this:
Ruby:
def vahprior = vol1.GetHighestValueArea();
def pocprior = vol1.GetPointOfControl();
def valprior = vol1.GetLowestValueArea();
 
Hello,

find the previous day's POC, VAH, and VAL using 3-minute aggregation ( code attached using Day Aggregation)
Borrowing from @FutureTony's
https://usethinkscript.com/threads/naked-poc-finder-for-thinkorswim.8215/

I have the code (attached) that finds the previous day's VAH, VAL, and POC with respect to "Day" aggregation. Can anyone please help as how to convert this code to find the VAH, VAL, and POC with respect to "minute" aggregation.

Thanks
Code:
rec count1 = CompoundValue(1, if !(GetDay() != GetDay()[1]) then count1[1] + 1 else 1, 1);
def priorperiod = if IsNaN(count1[1]) then 1 else Max(count1, count1[1]);
profile vol1 = VolumeProfile("startNewProfile" = GetDay() != GetDay()[1], "onExpansion" = no);

def vahprior = vol1.GetHighestValueArea();
def pocprior = vol1.GetPointOfControl();
def valprior = vol1.GetLowestValueArea();


plot vahprev = GetValue(vahprior, priorperiod);
vahprev.SetDefaultColor(Color.red);
vahprev.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HORIZONTAL);
vahprev.SetLineWeight(1);
vahprev.HideBubble();

plot pocprev = GetValue(pocprior, priorperiod);
pocprev.SetDefaultColor(Color.white);
pocprev.SetPaintingStrategy(PaintingStrategy.POINTS);
pocprev.SetLineWeight(1);
pocprev.HideBubble();

plot valprev = GetValue(valprior, priorperiod);
valprev.SetDefaultColor(Color.green);
valprev.SetPaintingStrategy(paintingStrategy = PaintingStrategy.HORIZONTAL);
valprev.SetLineWeight(1);
valprev.HideBubble();

Addlabel (yes, "PHVA.VOL ” +vahprev, color.red);
Addlabel (yes, "PPOC.VOL ” +pocprev, color.white);
Addlabel (yes, "PLVA.VOL ” +valprev, color.green);
 
Last edited by a moderator:
should I use it on 3 minute or, daily aggregation. Also, the plot shows at current days only, is it possible to all other previous days

It was written to be used on the 3m timeframe you requested. Make sure the chart and scan are the same timeframe settings.

To show previous days lines extended to the current day would require separate plots, changing the GetDay() == GetLastDay() - 1 to GetDay() == GetLastDay() - 2 etc for each previous day
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
529 Online
Create Post

Similar threads

Similar threads

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