Best way to calculate average (dollar/stock) volume?
Forums › ProRealTime English forum › ProScreener support › Best way to calculate average (dollar/stock) volume?
- This topic has 6 replies, 2 voices, and was last updated 3 years ago by
marie123.
-
-
03/19/2021 at 8:09 AM #164627
Hello,
I made this loop to calculate the average dollar and stock volume over the last 60 days. Is this the best way to do it or can I do it without a loop?
123456for i=60 downto 0 dototalDollarVol=totalDollarVol+volume[i]*close[i]totalStockVol=totalStockVol+volume[i]nextaverageDollarVol=totalDollarVol/60averageStockVol=totalStockVol/6003/19/2021 at 8:27 AM #16462903/19/2021 at 8:38 AM #16463003/19/2021 at 8:44 AM #164633Not sure to understand the question, if “check the volume from day 50” was a way to just accessing it, it’s volume[50]… but if you meant accessing the values from previous post on day 50, it’s same formula and using averageDollarVol[50] and averageStockVol[50]. If you meant something else, sorry I don’t understand could you please rephrase? Thanks.
03/19/2021 at 8:53 AM #164634When I use your formula I get the average volumes from today until day 60. That’s what I need when I analyze the current situation.
But I also need this for a backtest:
123456for i=110 downto 50 dototalDollarVol=totalDollarVol+volume[i]*close[i]totalStockVol=totalStockVol+volume[i]nextaverageDollarVol=totalDollarVol/60averageStockVol=totalStockVol/60Here I check another 60 days for the average volume but I start with a different day.
03/19/2021 at 8:58 AM #164635ok, 50 to 110 (not 100) so that you have a 60 too, but starting earlier in the past. Then it is indeed the second case: ” … but if you meant accessing the values from previous post on day 50, it’s same formula and using averageDollarVol[50] and averageStockVol[50]” :
12345averageDollarVol = average[60](volume*close)averageStockVol = average[60](volume)x=averageDollarVol[50]y=averageStockVol[50]NB: stricly speaking, it would have been 60 to 1, or 59 to 0, or 109 to 50 to get 60. If you really needed 60 to 0 / 110 to 50, then you can replace 60 by 61.
1 user thanked author for this post.
03/19/2021 at 9:17 AM #164638 -
AuthorPosts
Find exclusive trading pro-tools on