Date/Time: Thu, 21 Oct 2021 15:17:50 +0000
Post From: Time Period Volume (and Text Display)
|tomgilb - Posts: 3020|
Unless the time is exactly 09:34:00, the total volume (for the first 5 minutes of the opening range) will display as zero.True.
The formula in post #2 assumes you are using time-based bars of 1 min, and that ID1 would be edited to the ID# of the Spreadsheet Formula study you have added.
Since a bar's timestamp is at the Open, the 09:34:00 bar is the 5th bar since the Open.
If the formula locates the 09:34:00 bar, it sums the Volume of itself and of the 4 bars previous.
If the formula cannot locate the 09:34:00 bar, it returns 0.
The formula will make the value persistent until it can locate 09:34:00 again by repeating its previous value: ID1.SG1[-1]
The formula worked for me when I tested it, but it's possible there is floating point imprecision in the BARTIME value, so the formula cannot find the exact 09:34:00 time.
Try this formula:
This rounds the BARTIME to the millisecond and compares it to the TIME to the millisecond.
Date Time Of Last Edit: 2021-09-16 12:31:15