Volume Profile for 1st hour only

JoseyWales

New member
VIP
I wanted to modify the tos VP code so that it could show just one profile per day.
For example, I have a 1 minute chart and want to have a 15 minute profile but I only want to show the 1st 15 minute profile of that day.

I would set my time per profile to minutes with a multiplayer of 15. Problem is I get multiple 15 minute profiles throughout the day.

Is it possible to add some time qualifier in the code that says if the current time is greater than 15 minutes after open don't calculate it.
And an input to turn that on or off. "Show just 1st profile Y"

Thanks for any help anyone can provide
 
Solution
I wanted to modify the tos VP code so that it could show just one profile per day.
For example, I have a 1 minute chart and want to have a 15 minute profile but I only want to show the 1st 15 minute profile of that day.

I would set my time per profile to minutes with a multiplayer of 15. Problem is I get multiple 15 minute profiles throughout the day.

Is it possible to add some time qualifier in the code that says if the current time is greater than 15 minutes after open don't calculate it.
And an input to turn that on or off. "Show just 1st profile Y"

Thanks for any help anyone can provide

This will show the 1st 15m VolumeProfile POC, VAHigh and VALow lines, with an option to extend them
Added minutes as an input. Adjust...
I wanted to modify the tos VP code so that it could show just one profile per day.
For example, I have a 1 minute chart and want to have a 15 minute profile but I only want to show the 1st 15 minute profile of that day.

I would set my time per profile to minutes with a multiplayer of 15. Problem is I get multiple 15 minute profiles throughout the day.

Is it possible to add some time qualifier in the code that says if the current time is greater than 15 minutes after open don't calculate it.
And an input to turn that on or off. "Show just 1st profile Y"

Thanks for any help anyone can provide

This will show the 1st 15m VolumeProfile POC, VAHigh and VALow lines, with an option to extend them
Added minutes as an input. Adjust the time input end to match the minutes input. It is currently defaulted to 0945, which matches the 15m example

Screenshot 2024-08-09 144040.png

Code:
#VolumeProfile_1st_15m_Option_to_Extend

input extend  = yes;
input minutes = 15;
input begin   = 0930;
input end     = 0945;
def vpoc = reference VolumeProfile("time per profile" = "MINUTE", multiplier = minutes, "on expansion" = no).POC;
def vhi  = reference VolumeProfile("time per profile" = "MINUTE", multiplier = minutes, "on expansion" = no).VAHigh;
def vlo  = reference VolumeProfile("time per profile" = "MINUTE", multiplier = minutes, "on expansion" = no).VALow;
def vpoc_15 = if SecondsFromTime(begin) >= 0 and SecondsFromTime(end) < 0 then vpoc else if extend then vpoc_15[1] else double.nan;
def vhi_15 = if SecondsFromTime(begin) >= 0 and SecondsFromTime(end) < 0 then  vhi else if extend then vhi_15[1] else double.nan;
def vlo_15  = if SecondsFromTime(begin) >= 0 and SecondsFromTime(end) < 0 then  vlo else if extend then vlo_15[1] else double.nan;
plot poc    = vpoc_15;
plot VAHigh = vhi_15;
plot VALow  = vlo_15;

DefineGlobalColor("Profile", GetColor(1));
DefineGlobalColor("Point Of Control", GetColor(5));
DefineGlobalColor("Value Area", GetColor(8));

poc.SetDefaultColor(GlobalColor("Point Of Control"));
poc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VALow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetDefaultColor(GlobalColor("Value Area"));
VALow.SetDefaultColor(GlobalColor("Value Area"));

#
 
Last edited:
Solution
Thank you sleepy.
I will play with this and see if I have any questions

Thanks.

This is qwirky as we are provided little control of the volumeprofile indicator.
So this will not work for various number of minutes with extended hours selected as the minutes option starts at random times dependent on the number of bars on the chart.
It will work most reliably without extended hours selected
The following version does not require you to input an end time as it is calculated on input minutes
Hope you can find it useful!

Code:
#VolumeProfile_1st_X_minuts_Option_to_Extend

input extend  = yes;
input minutes = 15;
input begin   = 0930;

def hr  = Round(begin / 100, 0);
def min = begin - 100 * Round(begin / 100, 0);
def addlhrs = RoundDown(minutes / 60, 0);
def addlmin = minutes - addlhrs * 60;
def addlminhrs = if (min + addlmin) >= 60 then 1 else 0;
def addlminmin = min + addlmin - addlminhrs * 60;
def end        = (hr + addlhrs + addlminhrs) * 100 + addlminmin;
AddVerticalLine(SecondsFromTime(end) == 0, AsPrice(end), Color.WHITE);
def vpoc = reference VolumeProfile("time per profile" = "MINUTE", multiplier = minutes, "on expansion" = no).POC;
def vhi  = reference VolumeProfile("time per profile" = "MINUTE", multiplier = minutes, "on expansion" = no).VAHigh;
def vlo  = reference VolumeProfile("time per profile" = "MINUTE", multiplier = minutes, "on expansion" = no).VALow;
def vpoc_15 = if SecondsFromTime(begin) >= 0 and SecondsFromTime(end) < 0 then vpoc else if extend then vpoc_15[1] else Double.NaN;
def vhi_15 = if SecondsFromTime(begin) >= 0 and SecondsFromTime(end) < 0 then  vhi else if extend then vhi_15[1] else Double.NaN;
def vlo_15  = if SecondsFromTime(begin) >= 0 and SecondsFromTime(end) < 0 then  vlo else if extend then vlo_15[1] else Double.NaN;
plot poc    = vpoc_15;
plot VAHigh = vhi_15;
plot VALow  = vlo_15;

DefineGlobalColor("Profile", GetColor(1));
DefineGlobalColor("Point Of Control", GetColor(5));
DefineGlobalColor("Value Area", GetColor(8));

poc.SetDefaultColor(GlobalColor("Point Of Control"));
poc.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VALow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetDefaultColor(GlobalColor("Value Area"));
VALow.SetDefaultColor(GlobalColor("Value Area"));

#
 
Hello Sleepy

I just saw your reply this morning. Not sure I understand fully what you mean by not working for various number of minutes. I think your revised is easier for my purpose however. This is what I was writing at the time you sent that.

This is kind of working great.

My intent is to run this for consecutive 15 minute time periods starting at 9:30 until the end of day in order to track the POC movement.

So the start time is always 9:30 but the end time extends by 15 minutes each time.

I did see you created code to do this but as you pointed out it is very resource heavy. Eventually I want to go down to 5 minute intervals.

I believe I have the setting correct but am getting some unexpected results.

I originally put in just the 1st 15 minutes and all good. Then the second 15 also seemed okay but the more I put in the stranger the results were.

Here are my settings and I did change the total minutes and end time for each.

Also attached is the chart of the 1st 37 or so minutes. The POCS for this study are the dark yellow or gold ones.

The bottom is the 1st 15, the next up the second and the top is the last developing one.

The top one should start at 9:30 but isn’t. And it should be down close to the red line which is the daily poc on the tos study.

If these kinks can be worked out another wish list items would be:

Have the POCS draw from the previous end poc. Maybe a start draw time input. Still needs to be calculated from 9:30 though.

Sorry I should have added my original final intent in my first post.

2024-08-13-TOS_CHARTS.png



poc settings.png
 
Hello Sleepy

I just saw your reply this morning. Not sure I understand fully what you mean by not working for various number of minutes. I think your revised is easier for my purpose however. This is what I was writing at the time you sent that.

This is kind of working great.

My intent is to run this for consecutive 15 minute time periods starting at 9:30 until the end of day in order to track the POC movement.

So the start time is always 9:30 but the end time extends by 15 minutes each time.

I did see you created code to do this but as you pointed out it is very resource heavy. Eventually I want to go down to 5 minute intervals.

I believe I have the setting correct but am getting some unexpected results.

I originally put in just the 1st 15 minutes and all good. Then the second 15 also seemed okay but the more I put in the stranger the results were.

Here are my settings and I did change the total minutes and end time for each.

Also attached is the chart of the 1st 37 or so minutes. The POCS for this study are the dark yellow or gold ones.

The bottom is the 1st 15, the next up the second and the top is the last developing one.

The top one should start at 9:30 but isn’t. And it should be down close to the red line which is the daily poc on the tos study.

If these kinks can be worked out another wish list items would be:

Have the POCS draw from the previous end poc. Maybe a start draw time input. Still needs to be calculated from 9:30 though.

Sorry I should have added my original final intent in my first post.

View attachment 22603


View attachment 22604

If you are trying to track the bar by bar Daily movement of the POC/VAH/VAL lines, but want to lessen the performance hit of the previously provided bar by bar code, included in the folloing link, then the code in the link with a modification to allow a skipping of bars might work for you.

https://tos.mx/!o02sDatw

The image shows:
1. Regular Daily VolumeProfile as 3 lines
The Lines remain Horizontal throughout the Day and reflect the last values formed
2. Daily VolumeProfile Tracking in YELLOW Dots of the Bar by Bar tracking code
The Dots follow where the Horizontal Lines in '1.' have been throughout the Day
3. Daily VolumeProfile Tracking in Amber Dots of Bar by Bar, skipping plots every X bars input
The Dots also track the movement of the Horizontal Line, but update whenever input X bars occurs.
This might help the performance issue of the code described in '2' above.
The image shows an input bars = 5.
To track the whole day on 1m chart, use 2 copies,
one with bars = 5 and start = 0,
2nd with bars = 5 and start = 195
4. Regular VolumeProfile set to start at 0930 with a setting of timeperprofile of minutes, multiplier 20
This does not track the Daily VolumeProfile's movement profile by profile throughout the Day
It provides the Profile levels for the 20 minutes which may or may not be a Daily Profile levels

 
Last edited:

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
328 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