Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 17:33:38 +0000



Post From: Time Period Volume (and Text Display)

[2021-09-16 12:12:24]
Sawtooth - Posts: 3973
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:
=IF(MROUND(BARTIME,1/86400000)=TIME(09,34,00,000),SUM(V[0:-4]),ID1.SG1[-1])
This rounds the BARTIME to the millisecond and compares it to the TIME to the millisecond.

Spreadsheet Example Formulas and Usage: Using Date Time
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#MROUND_Function
https://www.sierrachart.com/index.php?page=doc/SpreadsheetFunctions.html#TIME_Function
Date Time Of Last Edit: 2021-09-16 12:31:15