projected volume = first 9min volume*(100/5.5)

jrmarkinv

New member
There is a research article that documented average volume profile in a day broken into about 9.5 min intervals. Looks like a bowl. I have it extracted in an excel file. The first 9 minutes account for average of 5.5% of daily volume. I am not good enough to program what's needed. But if someone can store the values in an array and then use a ratio of first 9 mins of volume in a day to get projected volume for day (projected volume = first 9min volume*(100/5.5). Can be updated every 9.5 minutes to improve forecast. Here is article:
 
Solution
@jrmarkinv,

Thank you for sharing the research...

The article you cited, while good I'm sure (FT is great), is behind a paywall and inaccessible for those without subscription.

It's an interesting idea. Would you mind sharing your spreadsheet of values? or the rough shape and proportions of the 'bowl'... the difficulty in adapting the method universally lies in figuring a formula for the shape of that bowl rather than applying mathematical approximations (which work on one timeframe but not necessarily others). I wonder if it would work on 10 min intervals, as that would open up several more charting opportunities (as multiples of several charts can be summed to be the first 10 minutes -- 1, 2, 5, and 10 while 9 can only...
@jrmarkinv,

Thank you for sharing the research...

The article you cited, while good I'm sure (FT is great), is behind a paywall and inaccessible for those without subscription.

It's an interesting idea. Would you mind sharing your spreadsheet of values? or the rough shape and proportions of the 'bowl'... the difficulty in adapting the method universally lies in figuring a formula for the shape of that bowl rather than applying mathematical approximations (which work on one timeframe but not necessarily others). I wonder if it would work on 10 min intervals, as that would open up several more charting opportunities (as multiples of several charts can be summed to be the first 10 minutes -- 1, 2, 5, and 10 while 9 can only be managed from 1m, and 3m unless you set a custom timeframe for 9m)

I do like a good mathematical challenge

-mashume
 
Solution

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

@jrmarkinv,

Thank you for sharing the research...

The article you cited, while good I'm sure (FT is great), is behind a paywall and inaccessible for those without subscription.

It's an interesting idea. Would you mind sharing your spreadsheet of values? or the rough shape and proportions of the 'bowl'... the difficulty in adapting the method universally lies in figuring a formula for the shape of that bowl rather than applying mathematical approximations (which work on one timeframe but not necessarily others). I wonder if it would work on 10 min intervals, as that would open up several more charting opportunities (as multiples of several charts can be summed to be the first 10 minutes -- 1, 2, 5, and 10 while 9 can only be managed from 1m, and 3m unless you set a custom timeframe for 9m)

I do like a good mathematical challenge

-mashume
Sure. Here it is in Pacific time.
FromTo%Cum%
9:30​
9:39​
5.5%​
5.5%​
9:39​
9:49​
3.6%​
9.1%​
9:49​
9:58​
3.1%​
12.2%​
9:58​
10:08​
2.8%​
15.0%​
10:08​
10:17​
2.5%​
17.5%​
10:17​
10:27​
2.3%​
19.8%​
10:27​
10:36​
2.2%​
22.0%​
10:36​
10:46​
2.1%​
24.1%​
10:46​
10:55​
2.0%​
26.1%​
10:55​
11:05​
2.1%​
28.2%​
11:05​
11:14​
2.0%​
30.2%​
11:14​
11:24​
2.0%​
32.2%​
11:24​
11:33​
2.0%​
34.2%​
11:33​
11:43​
1.9%​
36.1%​
11:43​
11:52​
1.8%​
37.9%​
11:52​
12:02​
1.7%​
39.6%​
12:02​
12:11​
1.7%​
41.3%​
12:11​
12:21​
1.6%​
42.9%​
12:21​
12:30​
1.5%​
44.4%​
12:30​
12:40​
1.4%​
45.8%​
12:40​
12:49​
1.4%​
47.2%​
12:49​
12:59​
1.4%​
48.6%​
12:59​
13:08​
1.4%​
50.0%​
13:08​
13:18​
1.6%​
51.6%​
13:18​
13:27​
1.4%​
53.0%​
13:27​
13:37​
1.4%​
54.4%​
13:37​
13:47​
1.4%​
55.8%​
13:47​
13:56​
1.4%​
57.2%​
13:56​
14:06​
1.4%​
58.6%​
14:06​
14:15​
1.6%​
60.2%​
14:15​
14:25​
1.7%​
61.9%​
14:25​
14:34​
1.8%​
63.7%​
14:34​
14:44​
1.8%​
65.5%​
14:44​
14:53​
1.8%​
67.3%​
14:53​
15:03​
1.9%​
69.2%​
15:03​
15:12​
1.9%​
71.1%​
15:12​
15:22​
2.2%​
73.3%​
15:22​
15:31​
2.3%​
75.6%​
15:31​
15:41​
3.0%​
78.6%​
15:41​
15:50​
4.2%​
82.8%​
15:50​
16:00​
9.0%​
91.8%​
Closing Auction
8.20%​
100.0%​
 
There is a graph in the FT article. BTW I don't have a subscription to FT but i am able to access it. I have set my chrome to delete all cookies from all sites including FT (I only allow specific sites i subscribe to). That might prevent it from detecting free article limits reached. That may be why i am able to read the article.
 
put in to a following sequence indicator, 9 minute start & stop times, to do a concise look back at each stop time (IVrT), take the (1) percentage plus the next 1+(1), adding in some sorting variable maybe 50% to start. lot of promise to markinv idea here

i don't know if a 3rd root of each cumulative 9 min interval highlighted at the top of a chart (red - yellow - green), would be possible, or any more technical variable would be any more reliable.

To try and then to create a leading indicator isn't impossible. The simple Hull indicator modified as example, leans to indicate futures movements easily.
 
There is a research article that documented average volume profile in a day broken into about 9.5 min intervals. Looks like a bowl. I have it extracted in an excel file. The first 9 minutes account for average of 5.5% of daily volume. I am not good enough to program what's needed. But if someone can store the values in an array and then use a ratio of first 9 mins of volume in a day to get projected volume for day (projected volume = first 9min volume*(100/5.5). Can be updated every 9.5 minutes to improve forecast. Here is article:
Maybe a rewritten base hull indicator based off the extend POC (point of control timing. Quite some bit of writing for each time period and the square root for variation, maybe a base of 50 periods back to scan
 
#RunSearch_Nine

#Extended POCs for x Daysback
#More can be added using the logic below
#Sleepyz - usethinkscript request @yardlay

script v {
input daysback = 1;
def volp = reference VolumeProfile("time per profile" = "DAY", "on expansion" = no, "price per row height mode" = "TICKSIZE");
def ymd = GetYYYYMMDD();
def y = if ymd != ymd[1] then y[1] + 1 else y[1];
def pc = if IsNaN(close)
then pc[1] else
if y == HighestAll(y) - daysback
then volp else
pc[1];


input multiplier = 1;
input onExpansion = no;
input profiles = 1000;
input showPointOfControl = yes;
input showValueArea = yes;
input valueAreaPercent = 70;


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);
 
There is a graph in the FT article. BTW I don't have a subscription to FT but i am able to access it. I have set my chrome to delete all cookies from all sites including FT (I only allow specific sites i subscribe to). That might prevent it from detecting free article limits reached. That may be why i am able to read the article.

where did those numbers come from?
are you saying that if you average the volume from many stocks, you come up with those %'s ?


here is a chart up to 16:00 , ( i didn't include the last 8.2% )

chart2 w formula
hkTfbiu.jpg


6 order polynomial
y = 3E-07x6 - 4E-05x5 + 0.0018x4 - 0.0414x3 + 0.4766x2 - 2.6204x + 7.6136
R² = 0.9388

y = 3E-07*x^6 - 4E-05*x^5 + 0.0018*x^4 - 0.0414*x^3 + 0.4766*x^2 - 2.6204*x^1 + 7.6136*x^0
 
Last edited:
where did those numbers come from?
are you saying that if you average the volume from many stocks, you come up with those %'s ?


here is a chart up to 16:00 , ( i didn't include the last 8.2% )
oWDSTYU.jpg
I've gotten as far as fitting a curve to the data to give me a function (6th order polynomial fits quite nicely) that will work with minutes past 9:30 and return the expected values. From that, I can get the expected cumulative value of the volume for a day and then a little bit more math should give me a volume prediction for the day. But i've got a full plate at the moment, so it'll have to wait a bit. I did work with the cumulative percentages rather than periodic so that I can just total volume so far that day for calculation... that means it would be a repainting kind of thing... see what I can do.

-mashume
 
I've gotten as far as fitting a curve to the data to give me a function (6th order polynomial fits quite nicely) that will work with minutes past 9:30 and return the expected values. From that, I can get the expected cumulative value of the volume for a day and then a little bit more math should give me a volume prediction for the day. But i've got a full plate at the moment, so it'll have to wait a bit. I did work with the cumulative percentages rather than periodic so that I can just total volume so far that day for calculation... that means it would be a repainting kind of thing... see what I can do.

-mashume
A statistiiiiiiiical variation with the ability to adjust for market cycles would be nice instead of a straight line cumulative volume value/day. It seems the predictive volume indicator would be more of a nibble & bite prompt, while pulling data from the extending variance end and into the volume indicator could indicate an unusual increase earlier as run up takes traction. If taken from a scanned set of stocks, then the predictive tendency could pick them and as volume increase over normal trades, you may see it, but as of now there is no certainty
 
where did those numbers come from?
are you saying that if you average the volume from many stocks, you come up with those %'s ?


here is a chart up to 16:00 , ( i didn't include the last 8.2% )

chart2 w formula
hkTfbiu.jpg


6 order polynomial
y = 3E-07x6 - 4E-05x5 + 0.0018x4 - 0.0414x3 + 0.4766x2 - 2.6204x + 7.6136
R² = 0.9388
If i remember right, it was calculated as an average for each of the 9.5 minute periods over hundreds of days (I think over 3 years). I wish i had just downloaded that research paper. Today, i can't access it online. The volume after 4pm eastern (about 9% that accounts for the 100%- total % till 4pm) is orders on close that are executed just after market close. Nice work on the polynomial. Pretty good fit. Thanks for the good work. It would be nice to create an indicator that uses your equation to flash an AddLabel saying whether volume is trending higher or lower than 30d average. I haven't coded anything using AggregationPeriod so it might take me a bit to create the script.
 
I've gotten as far as fitting a curve to the data to give me a function (6th order polynomial fits quite nicely) that will work with minutes past 9:30 and return the expected values. From that, I can get the expected cumulative value of the volume for a day and then a little bit more math should give me a volume prediction for the day. But i've got a full plate at the moment, so it'll have to wait a bit. I did work with the cumulative percentages rather than periodic so that I can just total volume so far that day for calculation... that means it would be a repainting kind of thing... see what I can do.

-mashume
mashume. If u would do it in the future, that would be great. Your coding skills are significantly better than mine. No rush.
 
Well, I had some time this morning and came up with this affront to sensibility:

LuuHxL6.png


Code:
# FT Percent of Day Volume by Time
# As adapted by Mashume
# for the Use ThinkScript Community
# 2022-07-13

declare lower;

def minutes = if secondsFromTime(0930) >= 0 AND SecondsTillTime(1600) >= 0  then (secondsFromTime(0930) / (60)) else double.nan;

def hours = minutes / 60;
def y =
  (-0.77245125* Power(hours, 6))
+ (13.13890801* (Power(hours, 5)))
+ (-76.64813184* (Power(hours, 4)))
+ (166.14466219* (Power(hours, 3)))
+ (-16.25423826* (Power(hours, 2)))
+ (-348.62204262* hours)
+ (465.46746546)
;

def v = volume;
def sum_v =  if secondsFromTime(0930) >= 0 AND SecondsTillTime(1600) >= 0  then sum_v[1] + v else 0;

def sum_y = if secondsFromTime(0930) >= 0 AND SecondsTillTime(1600) >= 0  then sum_y[1] + (y / 10000) else 0;

plot indicator = if sum_y != 0 then sum_v / sum_y[-1] else double.nan;

input lock_time = 30;
def lock = if minutes[1] < lock_time and minutes >= lock_time then 1 else 0;
addVerticalLine(lock, color = Color.gray);

def prediction = if minutes < lock_time then double.nan else if minutes[1] < lock_time and minutes >= lock_time then indicator else prediction[1];

plot volume_prediction = prediction;
volume_prediction.SetDefaultColor(color.gray);

AddLabel(yes, "Prediction at t: " + lock_time + "  : " + volume_prediction, color = Color.gray);
AddLabel(yes, "Current Pace:  " + asPercent(indicator / volume_prediction), color = Color.gray);

You can set the time you wish to 'lock in' the volume prediction for the day. That's the only adjustable parameter. I think it's pretty cool, though it doesn't seem to track properly for all of the instruments I looked at. It's a bit jumpy at the start of the day, as is to be expected, but it seems to be pretty close at predicting the total volume for the day. YMMV, of course.

interesting idea, math, and a fun coding challenge whether you find use in it or not.

Happy Trading,
-mashume

For those wondering why the value for y is 10000 times what it should be, it's because I had to get coefficients for the function that were in reasonable ranges for ToS to be able to calculate nicely. It was easier to do it this way.
 
Last edited:
Well, I had some time this morning and came up with this affront to sensibility:

LuuHxL6.png


Code:
# FT Percent of Day Volume by Time
# As adapted by Mashume
# for the Use ThinkScript Community
# 2022-07-13

declare lower;

def minutes = if secondsFromTime(0930) >= 0 AND SecondsTillTime(1600) >= 0  then (secondsFromTime(0930) / (60)) else double.nan;

def hours = minutes / 60;
def y =
  (-0.77245125* Power(hours, 6))
+ (13.13890801* (Power(hours, 5)))
+ (-76.64813184* (Power(hours, 4)))
+ (166.14466219* (Power(hours, 3)))
+ (-16.25423826* (Power(hours, 2)))
+ (-348.62204262* hours)
+ (465.46746546)
;

def v = volume;
def sum_v =  if secondsFromTime(0930) >= 0 AND SecondsTillTime(1600) >= 0  then sum_v[1] + v else 0;

def sum_y = if secondsFromTime(0930) >= 0 AND SecondsTillTime(1600) >= 0  then sum_y[1] + (y / 10000) else 0;

plot indicator = if sum_y != 0 then sum_v / sum_y[-1] else double.nan;

input lock_time = 30;
def lock = if minutes[1] < lock_time and minutes >= lock_time then 1 else 0;
addVerticalLine(lock, color = Color.gray);

def prediction = if minutes < lock_time then double.nan else if minutes[1] < lock_time and minutes >= lock_time then indicator else prediction[1];

plot volume_prediction = prediction;
volume_prediction.SetDefaultColor(color.gray);

AddLabel(yes, "Prediction at t: " + lock_time + "  : " + volume_prediction, color = Color.gray);
AddLabel(yes, "Current Pace:  " + asPercent(indicator / volume_prediction), color = Color.gray);

You can set the time you wish to 'lock in' the volume prediction for the day. That's the only adjustable parameter. I think it's pretty cool, though it doesn't seem to track properly for all of the instruments I looked at. It's a bit jumpy at the start of the day, as is to be expected, but it seems to be pretty close at predicting the total volume for the day. YMMV, of course.

interesting idea, math, and a fun coding challenge whether you find use in it or not.

Happy Trading,
-mashume

For those wondering why the value for y is 10000 times what it should be, it's because I had to get coefficients for the function that were in reasonable ranges for ToS to be able to calculate nicely. It was easier to do it this way.
Nice work. I think this is great. Can we also have option to do ratio of volume projection for stock vs volume projection for NYSE exchange (or SPY). Where i think this would be real useful for me would be to quickly identify which stocks or etfs in my watchlists (as a column) that have stochastic crossing above 20 (or crossing down below 80) during the morning and identify the ones where volume ratio is highest. I won't need to actually plot a chart but the call to plot is required (i believe) in order to assign a custom function to use as a column in watchlist to track such volume projection ratio. Just doing AddLabel statement and displaying the ratio as a value doesn't work from what i remember.
 
Mashume programmer expert extraordanaire has struck the first cut. Well done!

I still believe some type of inclusion of the actual 9-minute VolumePercent data sequentially expanded as the day runs is possible to program.
a bit arranged. [ (ej X el = Sjl), (e'1 X e'2 = +/-e'3), (e1X (e2 x e3) =+/- 1)] Where the result is +1, vectors' up, and if the system determined -1, then the vector(s) angular volatility becomes axial pseudo-vector or better said a bottom.

def volper = reference VolumePercent("time per profile" = "DAY",
"on expansion" = yes "percent per sequence interval" = "9-minutes");

def ymdm = GetYYYYMMDDmm();
 
Mashume programmer expert extraordanaire has struck the first cut. Well done!

I still believe some type of inclusion of the actual 9-minute VolumePercent data sequentially expanded as the day runs is possible to program.
a bit arranged. [ (ej X el = Sjl), (e'1 X e'2 = +/-e'3), (e1X (e2 x e3) =+/- 1)] Where the result is +1, vectors' up, and if the system determined -1, then the vector(s) angular volatility becomes axial pseudo-vector or better said a bottom.

def volper = reference VolumePercent("time per profile" = "DAY",
"on expansion" = yes "percent per sequence interval" = "9-minutes");

def ymdm = GetYYYYMMDDmm();
The projection line (the horizontal in the indicator) is the projected end of day volume total, as of the time you choose to 'lock in' the projection. The moving line is the current estimation of the total volume for the day and we can see how it moves relative to the initial projection (static line). The vertical line tells you where in the day you chose to lock in the projection value.

I'm not sure where including the 9-minute data would add to this... the equation in the indicator is a fairly good approximation of the percentages given in the table that was shared in this thread, and is used for calculation of values at whatever timeframe the user is looking at.

It could be I'm missing something big, but then again I'm being blind to it at the moment

-mashume
 
Mashume,

only looking at this part:
def v = volume;
def sum_v = if secondsFromTime(0930) >= 0 AND SecondsTillTime(1600) >= 0 then sum_v[1] + v else 0;
def sum_y = if secondsFromTime(0930) >= 0 AND SecondsTillTime(1600) >= 0 then sum_y[1] + (y / 10000) else 0;
plot indicator = if sum_y != 0 then sum_v / sum_y[-1] else double.nan;

and writing to plot movement current to 9.5 minute intervals:
(e'1 X e'2 = +/-e x 5.0%)
(e'2 X e'3 = +/-e x 3.6%)
(e'3 X e'4 = +/-e x 3.1%)
e'4 X e'5 = +/-e x 2.8%
e'5 X e'7 = +/-e x 2.5%
(e'7 X e'8 = +/-e x 2.3%)
e'8 X e'9 = +/-e x 2.2%
e'9X e'10 = +/-e x 2.1%
(e'10 X e'11 = +/-e x 2.0%)
e'11 X e'12 = +/-e x 2.0%
e'12 X e'13 = +/-e x 2.0%
(e'13 X e'14 = +/-e x 1.9%)
e'14 X e'15 = +/-e x1.8%
e'15X e'16 = +/-e x 1.7%
(e'16 X e'17 = +/-e x 1.7%)
e'17 X e'18 = +/-e x 1.6%
e'18 X e'19 = +/-e x 1.5%
(e'19 X e'20 = +/-e x 1.4%)
e'20 X e'21 = +/-e x 1.4%
e'21 X e'22 = +/-e x 1.4%
e'22 X e'23 = +/-e x 1.4%
(e23 X e'24 = +/-e x 1.4%)
e'24 X e'25 = +/-e x 1.6%
e'25X e'26 = +/-e x 1.7%
(e'26 X e'27 = +/-e x 1.8%)
e'27 X e'28 = +/-e x 1.8%
e'28 X e'29 = +/-e x 1.8%
(e'29 X e'30 = +/-e x 1.9%)
e'30 X e'31 = +/-e x 1.9%
e'31 X e'32 = +/-e x 2.2%
e'32 X e'33 = +/-e x 1.8%
(e'33 X e'34 = +/-e x 1.9%)
e'34 X e'35 = +/-e x 1.9%
e'35 X e'36 = +/-e x 2.2%
 
The projection line (the horizontal in the indicator) is the projected end of day volume total, as of the time you choose to 'lock in' the projection. The moving line is the current estimation of the total volume for the day and we can see how it moves relative to the initial projection (static line). The vertical line tells you where in the day you chose to lock in the projection value.

I'm not sure where including the 9-minute data would add to this... the equation in the indicator is a fairly good approximation of the percentages given in the table that was shared in this thread, and is used for calculation of values at whatever timeframe the user is looking at.

It could be I'm missing something big, but then again I'm being blind to it at the moment

-mashume
Mashume, I have made the following observation regarding SPX (and usually also QQQ or NDX):
On an up day, when the volume exceeds the volume from the last down day, market is moving up with high probability even in this bear environment. Vice versa also largely true.
So i want to create logic added to the projected volume code you developed to add that nuance and announce it via AddLabel.
So to track whether upmove is starting, i would want to find the last down day and compare projected volume for today vs volume of that last down day. If projected volume is greater, AddLabel should say Upmove. Can u help?
 
Mashume, I have made the following observation regarding SPX (and usually also QQQ or NDX):
On an up day, when the volume exceeds the volume from the last down day, market is moving up with high probability even in this bear environment. Vice versa also largely true.
So i want to create logic added to the projected volume code you developed to add that nuance and announce it via AddLabel.
So to track whether upmove is starting, i would want to find the last down day and compare projected volume for today vs volume of that last down day. If projected volume is greater, AddLabel should say Upmove. Can u help?
Further I want the comparison to always be SPX or SPY no matter the symbol in price panel.
To find the last down volume day i was thinking something like assigning a value to a z parameter which would take the value of number of days ago when the last down volume occurred.
def z = if close[1] < Close[2] then 1 else if Close[2] < Close[3] then 2 else if Close[3] < Close[4] then 3, else if Close[4]< Close[5] then 4 else if Close[5] < Close[6] then 5, else if Close[6] < Close[7] then 6, else double.NaN;
Not sure we can do a for loop because i want the process to stop the first instance when condition becomes true. And I figure 6 days is max up days but i could be wrong.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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