Support Board
Date/Time: Sun, 15 Jun 2025 16:02:16 +0000
[Programming Help] - ACSIL: Issue Setting Volume By Price Study Start Date/Time (Mode 5) Programmatically
View Count: 283
[2025-05-28 20:02:06] |
TB7000 - Posts: 19 |
Hello Sierra Chart Support, I'm attempting to programmatically setting the "Volume By Price" study's "Start Date" In:37 (Index 36) and "Start Time" In:39 (Index 38) with "Volume Graph Period Type" In:33 (Index 32) as 5 ("From Start Date-Time To End"). Changes to Mode 5 works as intended. However, for the starting date and time, the VbP study gets anchored to an incorrect date (often far in the future) and the time always defaults to 00:00:00. Attempts using sc.SetChartStudyInputInt for Inputs 36 and 38 with various integer formats (SCDateTime::GetDate()/GetTime(), YYYYMMDD/HHMMSS) report success via ACSIL but are misinterpreted by the VbP study, which seems to expect a different format or approach. What is the definitive ACSIL method and precise data format(s) required to reliably set both the start date and start time for the "Volume By Price" study's Inputs 36 (In:37) and 38 (In:39) (when its "Volume Graph Period Type" is 5), to achieve the correct result? I'm completely out of Ideas and would highly appreciate any guidance, hint or suggestion. Thanks in advance |
[2025-05-29 08:24:29] |
User431178 - Posts: 711 |
You need to use sc.SetChartStudyInputFloat, not sc.SetChartStudyInputInt. There is actually an example on the docs page for setting DateTime, so I won't write one here. ACSIL Interface Members - Functions: sc.SetChartStudyInputFloat() |
[2025-05-29 19:27:55] |
TB7000 - Posts: 19 |
Thank you for that answer. I did see that part of the documentation with a complete DateTime setting and did try different configurations using sc.SetChartStudyInputFloat(). Using Graph Period Type 5 (From Start Date-Time To End), I have two parameters to set: Start Date AND Start Time. When attempting to configure these, I was getting completely unexpected anchor points for the target VbP Study. After trying many different combinations and experiments, I am now doing the following: - I MUST set the Start Date Parameter to 0 (using sc.SetChartStudyInputInt). - THEN I set the Full DateTime into the Start Time Parameter (using sc.SetChartStudyInputFloat). This method is somewhat unexpected for me. At most, I would understand that programmatically one may only have to set the complete DateTime parameter directly into a single setting (e.g., the Time Parameter). However, what confuses me most is that to achieve this, I HAVE to first set the Date parameter to 0 and then populate the Time Parameter with the full DateTime value. All other combinations do not lead to the desired result. I'm still thinking that I'm not doing this properly, but at least it works for now. |
[2025-05-30 09:08:16] |
User431178 - Posts: 711 |
Using Graph Period Type 5 (From Start Date-Time To End), I have two parameters to set: Start Date AND Start Time. When attempting to configure these, I was getting completely unexpected anchor points for the target VbP Study. Before setting date or time with sc.SetChartStudyInputFloat: 1) Time value - you need to make sure that the date part is zeroed 2) Date value - you need to make sure that the time part is zeroed. Using input values: // time with no date component const auto time = SCDateTime(0, sc.Input[0].GetTime()); // date with no time component const auto date = SCDateTime(sc.Input[1].GetDate(), 0); Or if you are setting from a bar date/time value: // get current bar datetime and zero the date part auto time = sc.BaseDateTimeIn[sc.Index]; time.SetDate(0); // get current bar datetime and zero the time part auto date = sc.BaseDateTimeIn[sc.Index]; date.SetTime(0); |
[2025-05-30 12:39:04] |
TB7000 - Posts: 19 |
Oh that makes so much sense! (I feel really stupid right now) I've now applied that approach and everything is fine. Lost so much time on this one, glad it's finally fully solved. Many Thanks! |
To post a message in this thread, you need to log in with your Sierra Chart account: