Support Board
Date/Time: Sat, 23 Nov 2024 02:25:27 +0000
ACSIL Restart cumulative measurement with each new session
View Count: 119
[2024-09-24 04:04:59] |
User729073 - Posts: 2 |
Hi all, I'm wondering how to restart a measurement when a new session begins. I tried using `IsNewTradingDay` but that's only working for each new calendar day, not when my session and evening sessions change. if (sc.IsNewTradingDay(sc.Index)) { my_custom_cumulative_measurement = 0; } |
[2024-09-24 04:24:45] |
Tony - Posts: 516 |
what is your time zone and which instrument are you trading?
|
[2024-09-24 04:32:22] |
User729073 - Posts: 2 |
I'm looking at ES (front-month) and my time zone is set to US Eastern. My session times (regular and evening) are also set correctly to reflect this.
|
[2024-09-24 05:13:23] |
Tony - Posts: 516 |
yeah, I had similar issues quite a while ago (forget what it was), I got around it by doing this: SCDateTime _6h {SCDateTime::HOURS(6)}; if ((sc.BaseDateTimeIn[sc.Index]+_6h).GetDate() != (sc.BaseDateTimeIn[sc.Index-1]+_6h).GetDate()) { my_custom_cumulative_measurement = 0; } so, for the if() condition, we moved New York 6 time zones (6 hours) to the east, and session starts right at middle of the night, instead of 6pm, it fixed all my issues. You may need to change "sc.Index" to something else, if my_custom_cumulative_measurement is plotted the whole chart over multiple sessions, something like this: SCDateTime _6h {SCDateTime::HOURS(6)}; for (int IndexCount{sc.Index}; IndexCount>0; IndexCount--) { if ((sc.BaseDateTimeIn[IndexCount]+_6h).GetDate() != (sc.BaseDateTimeIn[IndexCount-1]+_6h).GetDate()) { my_custom_cumulative_measurement = 0; } } Date Time Of Last Edit: 2024-09-24 05:34:00
|
[2024-09-24 07:33:22] |
User431178 - Posts: 540 |
I'm wondering how to restart a measurement when a new session begins. I tried using `IsNewTradingDay` but that's only working for each new calendar day, not when my session and evening sessions change.
Take a look at 'Cumulative Delta Bars - Volume' in studies8.cpp (in your ACS_Source folder), it has example of how you can reset at both session start times. How to Build an Advanced Custom Study from Source Code: Searching for Source Code for Sierra Chart Built-In Studies |
To post a message in this thread, you need to log in with your Sierra Chart account: