Login Page - Create Account

Support Board


Date/Time: Tue, 14 Oct 2025 22:31:59 +0000



[Programming Help] - Autoscreenshot script

View Count: 143

[2025-09-19 09:30:57]
User565063 - Posts: 7
Hi,

attached is a C++ study for Sierra Chart using ACSIL that automates the process of opening charts for the symbols GC (Gold), ES (E-mini S&P 500), 6E (Euro FX), ZT (2-Year Treasury Note), and ZN (10-Year Treasury Note), setting each to a 10-second timeframe, and taking a screenshot for a specified day and time. When i compile the code using Build Custom studies DLL i receive the following message that I have been trying to fix:

The remote build is complete.
The build failed.
AutoChartScreenshot.cpp: In function 'void scsf_AutoChartScreenshot(SCStudyInterfaceRef)':
AutoChartScreenshot.cpp:50:45: error: 'IBPT_SECONDS_PER_BAR' was not declared in this scope; did you mean 'IBPT_MONTHS_PER_BAR'?
50 | chartParams.IntradayBarPeriodType = IBPT_SECONDS_PER_BAR;
| ^~~~~~~~~~~~~~~~~~~~
| IBPT_MONTHS_PER_BAR
AutoChartScreenshot.cpp:66:70: error: no match for call to '(SCDateTime) (int&, double)'
66 | sc.ScrollToDateTime(chartNumber, targetDateTime.GetAsDouble());
| ^
AutoChartScreenshot.cpp:85:13: error: 'SCT_PNG' was not declared in this scope; did you mean 'SC_NO'?
85 | SCT_PNG, // Image format
| ^~~~~~~
| SC_NO

Failed to generate the dll file.

-- End of Build -- 09:16:57

I was wondering if anyone can point me in the right direction.

Thank you very much
Giorgio
attachmentAutoChartScreenshot.cpp - Attached On 2025-09-19 09:29:58 UTC - Size: 3.7 KB - 43 views
[2025-09-19 09:53:29]
User431178 - Posts: 799
Checking the docs is probably a good starting point.
You can ask chatGPT or claude to search the docs and highlight the source of your errors.

ACSIL Interface Members - Functions: sc.SaveChartImageToFileExtended()
ACSIL Interface Members - Functions: sc.OpenChartOrGetChartReference()
ACSIL Interface Members - Variables and Arrays: sc.ScrollToDateTime

SaveChartImageToFileExtended
1. Declared as void, so does return a value.
2. You cannot check success/failure as it does not run until after your function returns
3. It does not have an image format parameter.

ScrollToDateTime
1. Is a member variable not a function and does not have a chartNumber parameter (should be sc.ScrollToDateTime = targetDateTime)

OpenChartOrGetChartReference
1. IBPT_SECONDS_PER_BAR does not exist, use IBPT_DAYS_MINS_SECS instead

Now one other problem that means the script will not work as you want, even if it compiles.

If this function is called multiple times during a call into a study function, only the most recent call will be processed. The other calls to this function will be disregarded.


You can probably write your own capture function if SaveChartImageToFileExtended isn't doing what you want.
Date Time Of Last Edit: 2025-09-19 09:57:04

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account