Intraday Volume Profile By Bar

hinkognito

New member
Greetings team.

Was hoping someone could help with this. Is it possible to plot the volume profile on a bar by bar basis?

For example, if I was looking at a 1m chart, instead of looking at the plots for the volume profile based on the cumulative data for the day, could the data be plotted based on the trading volume up to that point?

The goal is to plot the POC and Value Area High and Low as it changes over the course of the day, rather than seeing the entire plot change for the whole session.

Many thanks for taking the time!
 

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

Ajai - thanks for the response.

What I am actually seeking is a cumulative of profile that develops throughout the day.

For example, if I was looking at a 1min chart every bar would show the cumulative market profile up to the at candle close.
If I was looking at the chart for the whole trading day, I would be able to see the POC that developed throughout the day minute by minute.

Changing aggregation period will show the profile for each minute, but not for the cumulative minutes the market has been open for that trading day.
Looking at the /MES from July 10th, the days POC was 3149, but if I looked at the 1m aggregation, it shows the POC for each minute and at the final minute before the regular session close prints a 3177 POC.

I am seeking the latter where every minute, would plot the value area high and low and the POC from all of the cumulative volume data from the session open.

Would love to hear from you or anyone that has thoughts on this.
 
@hinkognito I'm looking for the exact same thing, this would make the formulation of strategies much easier since you would be able to see what the developing profile looked like at a point in the past.

An example of what we are looking for would be in the following scenario:
A 'daily' profile starts at 9:30 and goes until 4:15 pm eastern, after the day is over, we only end up seeing the final, developed profile. However, in the middle of the day, ex: 12:00 pm, the profile would have looked much different, and a trade that one might have taken based on the conditions at noon would no longer be visible at 4:15, so we basically want to see what the profile would have looked like, bar by bar, starting from the market open.

So if one is on the One-minute time frame, the calculations would be like this: 9:30 to 9:31, 9:30 to 9:32, 9:30 to 9:33, and so on, until we reach 4:15. The first thing that comes to mind for someone familiar with code (or at least me), is a loop function. To essentially refresh the profile and plot it, every minute until the end of a profile, starting from the open (or any other time for that matter).

Hope, I'm not wrongfully speaking for you, but let me know if this is what you are also looking for :)

Looking forward to anyone's ideas/thoughts on this, and if anyone would like to chime in and shed some light on this, I'm all ears!
 
@hinkognito
Saw this in a OneNote that contained a lounge archive from Wednesday, Sept. 26, 2018:

18:40 MetalMind: time period is any bars but say 1-min starting at 9:30 and moving with time
18:40 MetalMind: not moving, "expanding"
18:45 MetalMind: Tb8: what you always see is the last vol profile at the end of the segment. the "developing" here is for seeing the history of
18:58 Mobius: At any rate, all that is of no consequence since we have no array function in ThinkScript so can't code a custom Volume Profile even if we were so inclined.
18:59 MetalMind: Mobius: that's what i wanted to know, so from your experience you believe that I'm hitting a limit with thinkscript cababilities?
19:00 MetalMind: by the way, the way it's calculated is mentioned here in CALCULATION, and it's not standard deviation https://www.tradingview.com/wiki/Volume_Profile
19:01 MetalMind: so calculating it from scratch instead of using the existing VolumeProfile() build in function doesn't seem like a viable option for me.
19:04 Mobius: POC is the point of control. It moves all day until the highest volume node is found. TOS developers decided to plot that across the whole volume area instead of as a moving line. That may be something that could be added to with a recursive function to track it. But it seems a lot of work to test an idea to me.
19:05 Mobius: There's no standard deviation involved in Volume Profile. It's a simple array of all active price levels against the volume at that level. A pure spreadseet or as it's know in programming an array
19:07 Nube: Mobius, I've tried to track it. Doesn't work, seem to work same way as the All() functions
19:07 Mobius: Ah.. If you can't do it, it can't be done

19:08 MetalMind: Mobius: is there a way to create a new volume profile with each bar when using plot?
19:08 Tb8: I have been told it cannot be done, but Mobius is known for making an impossible possible, so I asked just in case
19:08 Mobius: metal... sure
19:08 MetalMind: my understanding is that when using "profile vol = ..." in a script is that it's calucated once, not with each bar.
19:08 Nube: I think I might know someone who's better with ThinkScript than I am
19:09 MetalMind: Mobius: should i use "script" for that or in the regular script flow?
19:10 Mobius: Metal.. That won't give you what you want. Each New Volume Profile would be stand alone with no way to accumulate past nodes
19:13 MetalMind: Mobius: if i can create a volume profile with each bar consisting of 2 or more segments, segment 2 always starts at the same fixed point but ends at an increasing duration, i'd be able to get the values i want one by one at each bar
19:13 Tb8: Apparently, it has something to do with not being able to pick a bar from the session because the profile always returns the last bar of the day's profile, so it seems that there is no way to store the last state of POC in a poor man's array. This is what I have been told, don't know if this is really the case.

19:14 Mobius: Metal... no you wouldn't.. First it's not volume at a bar it's volume at a price. Second you'd need an array of every price point in a period. That can't be done in TOS
19:18 MetalMind: Mobius: what i meant to use the bar to end the segment there and then get the corresponding values, same with the next bar, and so on
19:18 Mobius: Metal.. Sorry I see code. You see what you want. I see your not going to get it. You see the next wrong assumption
19:20 MetalMind: Mobius: that what I wanted to confirm from you, if it's doable or not to avoid wating time. thank you.
19:21 Mobius: Metal.. yw
19:21 MetalMind: Mobius: for my find trial, if i want to create a new vol profile with each bar, should i use "script"?
19:22 MetalMind: *final trial
19:23 Mobius: No you'd use the study I posted in MyTrade that plots volume profile or TPO at UI time segemts and change the segment to a time matching the bar time

This was an image that was referenced by MetalMind:
Develpoing_Profile.jpg

Which is part of an article by TradingView.

Mobius is a renowned thinkscripter and trader and he says it's unlikely, so It's not looking too great, but there's more digging to be done before calling it quits.

However, something that is very encouraging and shows that this can actually be done is that BEFORE Profiles were even introduced into TOS, a version of it was coded by thinkscripter (the hyperlink goes to an archived page that no longer exists and took me FOREVER to find btw).
The only thing is, he created it as a paid indicator back in 2009. Maybe if I ask properly, he might just give it out, since its a 12yo indicator, but I feel the logic behind it is still very relevant.

This is further validated, considering Mobius and some other guys simple said it couldn't be done 2 year ago, when Thinkscripter did it in 2009!

Would appreciate everyone's thoughts. more so, if anyone with relatively more experience/confidence wishes to further this goal

Side note: I'm surprised this isn't gaining much traction, despite massive utility for every intraday trader, rivaling VWAP and the like :/
 
Last edited:
https://web.archive.org/web/2010040...r.com/2009/09/05/thinkscripter-volume-profile looks like regular volume profile with fib lines and linear regression with a yellow colored POC and purple colored price marker.
Right, but the object of interest is the profile. The whole point is to create the volume profile algorithm as separate from the built-in function, so we can reference values sequentially to create a developing profile!

Don't know if you missed this, but he posted this update at the top of the article:
UPDATE MARCH 2010: The various profile studies (Volume/TPO) have been implemented natively by TOS and replace my thinkScript versions. I will leave these studies in the PRO bundle for those interested in looking at the code but I recommend using the new TOS versions henceforth. – Eric

He published the indicator back in Sep 5th, 2009, before TOS implemented it themselves, so if the dates are not mistaken, he essentially created something 12 years ago which Mobius and others are saying are impossible 9 years later... :)

Edit: the timing of this article also seems to be in line with thinkscripter developing a profile!
 
Last edited:
This looks promising, and uses the built in profile:

Code:
#@growex on Futures.io
def d = BarNumber();
input bar1 = 1;
input bar2 = 40;
def endbar = HighestAll(BarNumber());
def cond = d <= bar1 or d >= bar2;
input pricePerRowHeightMode = {default AUTOMATIC, TICKSIZE, CUSTOM};
input customRowHeight = 1.0;
input multiplier = 1;
def onExpansion = no;
input profiles = 2;
input showPointOfControl = yes;
input showValueArea = yes;
input valueAreaPercent = 70;
input opacity = 50;
def height;
switch (pricePerRowHeightMode) {
case AUTOMATIC:
    height = PricePerRow.AUTOMATIC;
case TICKSIZE:
    height = PricePerRow.TICKSIZE;
case CUSTOM:
    height = customRowHeight;
}

profile vol = VolumeProfile("startNewProfile" = cond !=cond[1], "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();
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;
DefineGlobalColor("Profile", GetColor(1));
DefineGlobalColor("Point Of Control", GetColor(5));
DefineGlobalColor("Value Area", GetColor(8));
vol.Show(GlobalColor("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"));
POC.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VALow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
VAHigh.SetDefaultColor(GlobalColor("Value Area"));
VALow.SetDefaultColor(GlobalColor("Value Area"));
ProfileHigh.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileLow.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ProfileHigh.SetDefaultColor(GetColor(3));
ProfileLow.SetDefaultColor(GetColor(3));
ProfileHigh.Hide();
ProfileLow.Hide();

Let me know what you all think of this, I gtg sleep. 🥱:sleep:
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
432 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