Support Board
Date/Time: Fri, 24 Oct 2025 13:43:36 +0000
[User Discussion] How can I set a update interval for a custom ACSIL study?
View Count: 1388
| [2020-02-09 12:19:24] |
| User353585 - Posts: 69 |
|
hello, I want to set a longer update interval for a specific study to reduce CPU usage, for example for a minute. I don't want to set the update interval of whole chart because it would slow everything down obviously. I think it could be achieved by adding few codes in front of the study code... I wonder if anyone has a helpful tip for this. |
| [2020-02-09 15:19:58] |
| Ackin - Posts: 1865 |
|
anyone has a helpful tip for this
use - SCDateTime CurrentDateTime; - pointer to last update time - compare last change time + one minute with currentdatetime - when condition is true then update study calculation |
| [2020-02-09 17:41:38] |
| User353585 - Posts: 69 |
|
Thank you Ackin! I was able to make a working example! here's the code : //////////////////////////////////////////////////////// SCDateTime currentdatetime = sc.GetCurrentDateTime(); SCDateTime& datetimestamp = sc.GetPersistentSCDateTime(1); bool run_code; if (!datetimestamp) run_code = true; else if ((datetimestamp + 60*SECONDS)<currentdatetime) run_code = true; else run_code = false; if (run_code == true) { //Code you want to run datetimestamp = currentdatetime; } /////////////////////////////////////////////////////// Date Time Of Last Edit: 2020-02-09 17:43:59
|
| [2020-02-09 18:44:25] |
| Ackin - Posts: 1865 |
|
if (sc.IsReplayRunning()) CurrentDateTime = sc.CurrentDateTimeForReplay; else CurrentDateTime = sc.CurrentSystemDateTime; |
To post a message in this thread, you need to log in with your Sierra Chart account:
