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...
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.
An interesting observation. If no one else beats me to it I'll see about a label a little later on today or tomorrow.

-mashume
 

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

Well...

There seems to be some discrepancy between the daily volume and the calculated RTH volume I'm able to get my code to read...
vn66g4f.png

Lower indicator projections match totals closely the last two days at ~28M, but the black labels on the upper show volumes of 80M and 76M. Not sure how to reconcile those things to be able to compare them.

I'll take a look further, but if anyone knows how to get just the portion of the day for RTH volume, I'd appreciate it... if that's what is going on here.

-mashume

Oh yeah this is the code I am using...
Code:
def SPYDailyClose = getValue(close(symbol = "SPY", period = AggregationPeriod.DAY), "dynamic offset" = 5);

def UpCloseBoolean = if SPYDailyClose[1] > SPYDailyClose[2] then 1 else 0;
def DownCloseBoolean = if SPYDailyClose[1] < SPYDailyClose[2] then 1 else 0;
def UPDayVolume = if UpCloseBoolean == 1 then VOLUME(symbol = "SPY", period = AggregationPeriod.DAY)[1] else UpDayVolume[1];
def DownDayVolume = if DownCloseBoolean == 1 then VOLUME(symbol = "SPY", period = AggregationPeriod.DAY)[1] else DownDayVolume[1];

AddLabel(yes, "  Last Down Day Volume = " + DownDayVolume + "   ", color.black);
AddLabel(yes, "  Last UP day Volume = " + UpDayVolume + "   ", color.black);
 
Last edited:
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.

maybe this can help, an answer by sleepyz, that looks for 3 non sequential up and down bars, in the past.
https://usethinkscript.com/threads/lowest-open-of-the-last-3-up-bars-or-down-bars.12625/#post-107930
 
Well...

There seems to be some discrepancy between the daily volume and the calculated RTH volume I'm able to get my code to read...
vn66g4f.png

Lower indicator projections match totals closely the last two days at ~28M, but the black labels on the upper show volumes of 80M and 76M. Not sure how to reconcile those things to be able to compare them.

I'll take a look further, but if anyone knows how to get just the portion of the day for RTH volume, I'd appreciate it... if that's what is going on here.

-mashume

Oh yeah this is the code I am using...
Code:
def SPYDailyClose = getValue(close(symbol = "SPY", period = AggregationPeriod.DAY), "dynamic offset" = 5);

def UpCloseBoolean = if SPYDailyClose[1] > SPYDailyClose[2] then 1 else 0;
def DownCloseBoolean = if SPYDailyClose[1] < SPYDailyClose[2] then 1 else 0;
def UPDayVolume = if UpCloseBoolean == 1 then VOLUME(symbol = "SPY", period = AggregationPeriod.DAY)[1] else UpDayVolume[1];
def DownDayVolume = if DownCloseBoolean == 1 then VOLUME(symbol = "SPY", period = AggregationPeriod.DAY)[1] else DownDayVolume[1];

AddLabel(yes, "  Last Down Day Volume = " + DownDayVolume + "   ", color.black);
AddLabel(yes, "  Last UP day Volume = " + UpDayVolume + "   ", color.black);
Mashume, the last UP DAY volume in your plot is accurate (for Sept 9 in TOS vol is 76.7M) . That means projected volume numbers are way off. Similarly Last DOWN DAY before (not including today, Sept 13) was Sept 6 with a volume of 76.6M. Your plot says 80.8M. Sept 8 had 80.8M volume but that was an up day.
 
Mashume, the last UP DAY volume in your plot is accurate (for Sept 9 in TOS vol is 76.7M) . That means projected volume numbers are way off. Similarly Last DOWN DAY before (not including today, Sept 13) was Sept 6 with a volume of 76.6M. Your plot says 80.8M. Sept 8 had 80.8M volume but that was an up day.
I will try to figure out from your code if i can fix it.
 
I will try to figure out from your code if i can fix it.
I fitted the time and volume% data in excel and did a polynomial(6) fit (equation is different from yours). The fit is for cumulative minutes from 9:30am vs cumulative volume%. Then i used that formula in a simplified thinkscript version of your code (no after-hours being plotted) but something is not working right. Projected volume should be near constant during day but it ramps up everyday on a 5 minute chart or a 1 minute chart. I do know that the cumulative minutes from 9:30am plots correctly if i plot that alone. I was hoping to be able to attach the excel file but can't figure out how. Here is thinkscript code:

declare lower;
def v = volume;

def minutes = secondsFromTime(0930) / (60);

plot volume_prediction = (1/0.92)v(
(24947* Power(minutes, 6))
  • (17495* (Power(minutes, 5)))
  • (4585.2* (Power(minutes, 4)))
  • (-519.63* (Power(minutes, 3)))
  • (14.241* (Power(minutes, 2)))
  • (4.1379* minutes)
  • (0.0033))
;

AddLabel(yes, "Prediction " + volume_prediction, Color.gray);
 
#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);

Hi, I tried using some of this code to solve a different problem that I've asked for help with but I think no one has found a solution (https://usethinkscript.com/threads/...ile-get-error-can-not-call-hide-on-vol.12711/). I cannot get "reference VolumeProfile" to work in a way that allows for calling the function "GetPointofControl". Instead it only seems possible to use "GetPointofControl" after creating the volume profile with "profile vol = VolumeProfile(..etc...)".

Just wanted to make sure, were you actually able to make a volume profile with a point of control value generate using "reference" instead of "profile" in the syntax? Likewise, I could never get a volume profile with POC to generate inside of a subscript. So I have not been able to find a solution for getting the POC value without creating a shadow profile plot which (even when no visualization is defined) causes scaling problems within the study that I want to use the POC value in as a variable.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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