Login Page - Create Account

Support Board


Date/Time: Mon, 16 Jun 2025 17:50:23 +0000



Post From: Sum of Values restricted to Session/Trading Day

[2025-04-30 09:07:46]
pjk0225 - Posts: 42
I'm trying to get the sum of historical values of a custom study for each trading session over one year.
Right now, I'm having a problem where some of the values counted in the sum are being double-counted.
The formula I'm using is a spreadsheet formula:
sum(ID237.sg1[0:-450])
On some days, there are less than 450 bars, so the sum will "overflow" into the previous day.
Since I want the sum of each day, I'm outputting the sums on a spreadsheet and locate the last bar for each day to get that day's sum.
Is there a way I can avoid the double-counting? How can I make sure the sum doesn't include values that don't match the date of the last bar of the day's session?