Login Page - Create Account

Support Board


Date/Time: Mon, 25 Nov 2024 09:34:02 +0000



I need automatically take screen shots of entire SC window

View Count: 2008

[2018-10-16 19:19:11]
User517260 - Posts: 97
Dear Support, my client requested me: "I need a indicator which automatically takes screen shot of my entire sierra window and store in specified directory". I didn't find in SC function which allow make snapshots of screen by ACSIL methods. Could you tell me - does it have sense to use SC tools for this taks or may be it is more effective to use screenshot capture program? Thanks, Alex.
[2018-10-16 19:31:43]
Sierra Chart Engineering - Posts: 104368
There is this ACSIL function:
sc.SaveChartImageToFileExtended

However, it is just for capturing an image of the chart.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2018-10-16 20:50:22]
User517260 - Posts: 97
Thanks!
[2022-03-02 00:05:58]
User240019 - Posts: 112
Do you have an example of how you might use this function with every fill?

The use-case is taking a screenshot of your chart(s) on the fill of a trade through to the exit.

What I would want is for SC to save a screenshot to a folder as soon as I'm filled and then every time there's another fill until the order is completed.
[2022-03-02 03:10:59]
traderacefly - Posts: 57
Check out https://www.simplesystemtrading.com/, Frederik has a screenshot study in his free bundle (see attached screenshot, no pun intended). It automagically triggers when a trade occurs and stores the screenshots in an images folder inside the SC installation folder. The caveat is that it only captures the chart that the study is applied to and not your entire screen.
Date Time Of Last Edit: 2022-03-02 03:14:23
image2022-03-01_21-04-13.png / V - Attached On 2022-03-02 03:05:23 UTC - Size: 19.13 KB - 297 views
[2022-03-02 16:39:59]
User240019 - Posts: 112
Exactly what I wanted! Now I'm gonna use SC's tools to see how it was built!
[2024-03-12 12:25:54]
User676363 - Posts: 72
I have a batch screenshot generator.
Save it to your ACS_Source folder in Sierrachart as screenshot.cpp
Compile it using Analysis > Build Custom Studies DLL
Add it to a chart as a custom study and it will run one round of capturing all charts in the chartbook.
Then, save that as Batch Screenshot Run+
Next time you need it, you can add it again and it will run another set of screenshots.

Ideas for improvement:
- Build a UI (I don't know how to do this yet)
- Perhaps offer some options in settings in terms of how to format the filenames
- Automatically remove the study after it has run. Sort of creates a problem for saving it as a study since it runs automatically.
No harm in really loading it multiple times and then deleting it, but maybe somebody can improve on it.


It will produce a file for each chart number in the chart book like this: 2024-03-12_08_05_37_000_xx
That gives you a yyyy-mm-dd_hh_mm_ss_mms_chartnumber which should sort nicely.



// The top of every source code file must include this line
#include "sierrachart.h"

// For reference, refer to this page:
// Advanced Custom Study Interface and Language (ACSIL)

// This line is required. Change the text within the quote
// marks to what you want to name your group of custom studies.
SCDLLName("Screenshot Script")

// Function to take screenshots of all chart windows in the current chartbook
SCSFExport scsf_TakeScreenshots(SCStudyInterfaceRef sc)
{

sc.GraphRegion = 1; // Use chart region #1 so as to not add another region to the existing chart just for this

// Declare and configure the Active input variable
SCInputRef Active = sc.Input[0];
Active.Name = "Active"; // Set the name of the input variable
Active.SetYesNo(1); // Set the default value - will run once
Active.SetIntLimits(0, 1); // Set the range of allowed values

// Check if the user has activated screenshot generation
if (Active.GetYesNo())
{
// Reset the active input to 0 to prevent repeated screenshot generation
Active.SetYesNo(0);
sc.AddMessageToLog("Screenshot batch start requested.", 0);

// Get the highest chart number used in the chartbook
int highestChartNumber = sc.GetHighestChartNumberUsedInChartBook();
SCString MessageText("sc.GetHighestChartNumberUsedInChartBook = ");
MessageText.AppendFormat("%d", highestChartNumber);
sc.AddMessageToLog(MessageText, 0);

// Get current date and time
SCDateTime currentDateTime = sc.CurrentSystemDateTime;

// Format date and time strings
SCString date;
date.Format("%04d-%02d-%02d", currentDateTime.GetYear(), currentDateTime.GetMonth(), currentDateTime.GetDay());

SCString time;
time.Format("%02d_%02d_%02d_%03d", currentDateTime.GetHour(), currentDateTime.GetMinute(), currentDateTime.GetSecond(), currentDateTime.GetMillisecond());

sc.AddMessageToLog("Entering loop to generate screenshots now.", 0);

// Iterate through each chart window
for (int chartNumber = 1; chartNumber <= highestChartNumber; ++chartNumber)
{
// Set the filename for the screenshot
SCString fileName;
fileName.Format("%s_%s_%d.png", date.GetChars(), time.GetChars(), chartNumber);

SCString MessageText("Writing screenshot:");
MessageText.AppendFormat("%s", fileName.GetChars());
sc.AddMessageToLog(MessageText, 0);

// Take the screenshot and save it to file
sc.SaveChartImageToFileExtended(chartNumber, fileName, 0, 0, 0);
}

// Provide feedback to the user
sc.AddMessageToLog("Screenshots generation completed.", 0);
}
}


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

Login

Login Page - Create Account