Today vs Yesterday current cumulative volume comparison

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #173069 quote
    Karen
    Participant
    Average

    Good day,

    I am stuck with the task to add a comparison of:

     

    To my screener. Is there a proper method to do that? All I came across have some limitations and/or built in data imperfections due to premarket volume.

    Thanks!

    #173080 quote
    robertogozzi
    Moderator
    Master

    Post your topic in the correct forum:
    _ ProRealTime Platform Support: only platform related issues.
    _ ProOrder: only strategy topics.
    _ ProBuilder: only indicator topics.
    _ ProScreener: only screener topics
    _ General Discussion: any other topics.
    _ Welcome New Members: for new forum members to introduce themselves.

    Thank you 🙂

    I moved it from ProRealTime Platform Support.

    #173081 quote
    robertogozzi
    Moderator
    Master

    Currently, screeners have a 254-bar look back limit.
    You cannot go beyond that limit.

    Karen thanked this post
    #173082 quote
    Karen
    Participant
    Average

    Roberto, thank you for the clarification, it’s a very important information (and I’m sorry for mixing forums, will do better next time).

    Regarding the volume analysis – is there a way to exclude afterhours/premarket bars? If I got it right, screener will look for 254 bars irregardles whether it’s main trading session or not, and I’d like to analyze only main session data. Is there a way to do that?

    #173089 quote
    robertogozzi
    Moderator
    Master

    PRT’s settings allow plotting on a chart some premarket data, but I as far as I know there’s no way to exclude some periods.

    You have to code your screener to only account for data from a starting hhmmss to  an ending hhmmsd.

    Karen thanked this post
    #173321 quote
    Karen
    Participant
    Average

    I’ve successfully excluded premarket data by adding extra time settings like so:

    time > 093000  and time < 160000

    Still, I am desperately in need of a way to compare current cumulative volume up to this time of today with cumulative volume up to this time of previous trading day.

    I understand the 254-bar look back limitation (Roberto, thank you again), so I can see that my only option would be to use 5 minute timeframe – but I can’t figure out how to implement such a comparison. Any help would be much appreciated.

    #173322 quote
    robertogozzi
    Moderator
    Master

    What time? Can you make an example?

    Karen thanked this post
    #173333 quote
    Karen
    Participant
    Average

    Roberto, at any time during the trading session I’d like my screener to be able to compare the ratio of the current accumulated volume to the accumulated volume to the same time yesterday.

    For example, lets say currently it’s 9:45 am of July 7 (15 minutes into the market) and my screener is looking at BSQR. By 9:45 BSQR has 3728168 volume (I’ve summarized three 5-minute candles of volume by hand).

    Now, “yesterday”, July 6, during that same period of time, 9:30 to 9:45 – BSQR had 12168494 volume. So now my screener is aware of those numbers, and I can easily calculate “ 

    #173345 quote
    robertogozzi
    Moderator
    Master

    Try this one:

    IF Time = 094500 THEN
       CumVol = CurVol
       CurVol = 0
    ENDIF
    CurVol = CurVol + Volume
    SCREENER[CumVol](CumVol AS "Cum.Volume")
    #173354 quote
    Karen
    Participant
    Average

    Roberto, thank you very much for your help, but perhaps I didn’t explain the task correctly.

    Your code, if I get it right, counts total volume for today (with the limit of 9:45). What I am looking for, is a code for screener, which can count total volume for whatever time it is right now (but only within main trading session) and compare it with the total volume for that same exact period of yesterday’s main trading session.

    I’ve found almost identical task at this topic: https://www.prorealcode.com/topic/intraday-relative-volume-for-5min-chart/ but the screener code from that topic suffers from issues due to premarket/afterhours candles, the offset is calculated incorrectly.

    If you can suggest a way to safely exclude premarket/afterhour candles with that screener, so we can analyze exclusively main trading session – that would be brilliant.

    #173361 quote
    robertogozzi
    Moderator
    Master

    There you go, but you have to change the time for unwanted trading hours (mine is just an example, from 080000 through 083000):

    i      = 1
    CumVol = 0
    WHILE i < 254
       IF Time[i] <> Time THEN
          IF Time[i] >= 080000 AND Time[i] <= 083000 THEN
             CumVol = CumVol + Volume[i]
          ENDIF
       ELSE
          Break
       ENDIF
       i = i + 1
    WEND
    SCREENER[CumVol](CumVol AS "Cum.Volume")
    Karen thanked this post
    #173487 quote
    Karen
    Participant
    Average

    Roberto, thanks again for your help!

    Can you help me calculate the cumulative volume in a similar fashion for “yesterday”, also from 8 to 8:30 (I will use the formula on the 5 minute timeframe).

    #173526 quote
    robertogozzi
    Moderator
    Master

    Try this one, but I could not check if volume data is correct.

    You should also bear in mind that if the prior day spans across the 254-bar limut, results will be inaccurate.

    j       = 0
    i       = -1
    CumVol  = 0
    WHILE j < 253
       IF (Time[j + 1] > Time[j]) AND (i < 0) THEN
          i = j + 1                               //This is where the prior day starts
       ENDIF
       IF i >= 0 THEN
          IF Time[i] >= 080000 AND Time[i] <= 083000 THEN
             CumVol = CumVol + Volume[i]
          ENDIF
          i = i + 1
       ENDIF
       j = j + 1
    WEND
    SCREENER[CumVol](CumVol AS "Cum.Volume")
    Karen thanked this post
    #173580 quote
    robertogozzi
    Moderator
    Master

    Try this update:

    CumVol = 0
    j       = 0
    i       = -1
    WHILE j < 253
       IF Time >= 0 AND Time < Time[1] THEN
          CumVol = 0
          i = j + 1                               //This is where the prior day starts
       ENDIF
       IF i > 0 THEN
          IF Time[i] >= 160000 THEN
             IF Time[i] <= 163000 THEN
                CumVol = CumVol + Volume[i]
             ELSE
                i = -1
             ENDIF
          ENDIF
          i = i + 1
       ENDIF
       j = j + 1
    WEND
    SCREENER[CumVol](CumVol AS "Cum.Volume")
    Karen thanked this post
Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.

Today vs Yesterday current cumulative volume comparison


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Karen @karen Participant
Summary

This topic contains 13 replies,
has 2 voices, and was last updated by robertogozzi
4 years, 8 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 07/03/2021
Status: Active
Attachments: No files
Logo Logo
Loading...