How can i call the volume for each 30 min bar of the previous day? and the previous week same day (30 min)?

Forums ProRealTime English forum ProBuilder support How can i call the volume for each 30 min bar of the previous day? and the previous week same day (30 min)?

Viewing 11 posts - 1 through 11 (of 11 total)
  • #155519

    Good morning Roberto and Vonasi, can I ask another question please. On a 30min TF (for example), how can i call the volume for each 30 min bar of the previous day? and the previous week same day (30 min)?

    Example: we are 29 Dec. and I would like to plot (1) the current day volume between 9.00 am and 9.30 am, with (2) the 30 min volume of 28 Dec. between 9am and 9.30 am, with the (3) the last week (22 Dec.) volume between 9am and 9.30 am.

    Thank you

    #155526

    You can use arrays, 48 elements for the Daily array (24 hours * 2 elements each hour) and 240 for the Weekly array (24 hours * 2 elements * 5 days).

    Each 30 minutes you will need to shift all elements 1 place to make room for the new one.

     

     

    1 user thanked author for this post.
    #155529

    Do not append different questions to exixting topics. Start a new one, instead. Thank you 🙂

    I did it.

     

    1 user thanked author for this post.
    #155541

    This returns the volume at the same time the previous day:

     

    2 users thanked author for this post.
    #155549

    Thanks a million Vonasi!

    #155668

    Sorry but I finally got around to testing that last bit of code and it only works for the first tick at the open of a new volume bar and after that the values update incorrectly.

    So I stopped trying to be clever by using arrays and went back to old fashioned loops. It is much slower to load but at least the results are correct. This one includes the volume from this time a week ago too.

     

    Here is a version that when applied to a volume chart draws points showing the previous days volume for the same candle at this time and the previous weeks volume for the same candle on the same day.

     

    #155765

    Thank you Vonasi. You’re a MASTER! I beleive this can help day traders to detect unusual volume spike during the day or to eliminate noise when price varies without volume.

    Again, thank you and happy holiday season!

     

    #156706

    @Vonasi, @robertogozzi, @Nicolas,

    Happy New Year!

    Khaled

    1 user thanked author for this post.
    #156711

    FYI, intraday relative volume comparison as an indicator can be found here: https://www.prorealcode.com/topic/relative-volume-rvol/#post-125548

    1 user thanked author for this post.
    #173633
    Dear @Vonasi and PRC community

    Based on this great example, I tried to implement code for a screener that would allow me to calculate “Current cumulative volume up to this time of today / Cumulative volume up to this time of yesterday”. It looks like this:

    Unfortunately, it did not work properly. When I check and manually count yesterday’s volume to some point in time, I can see that the lastvol is not counted correctly for that period. Could you help me fix a bug that is causing an incorrect calculation of lastvol?

    #173639

    It looks like I finally managed to solve this problem. This code is extremely slow, so it will take a lot of thinking to optimize it (and I would really appreciate tips on improving it – because it’s really VERY slow while using as a screener), but finally I can compare exact volumes!

Viewing 11 posts - 1 through 11 (of 11 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login