Login Page - Create Account

Support Board


Date/Time: Sat, 19 Apr 2025 16:10:56 +0000



Post From: ACSIL : save image per closed bar ?

[2020-11-07 13:43:12]
User818063 - Posts: 16
Hi,

Is it possible to save an image in ACSIL, each time a study function returns to Sierra code ? (I use using sc.SaveChartImageToFileExtended).

The documentation states that if the save function is called multiple times during a call into a study function, only the most recent call will be processed.
If I understand correctly, it means an image can be saved after after each call into a study function. For example, I could do screenshot once per closed bar.
Unfortunately, this does not work, only the last image was saved, which means I do not understand the documentation, or that something is wrong with the save function.

Please advise.

Here is a small study for making a screenshot per closed bar to illustrate the problem.


#include "sierrachart.h"

SCDLLName("SSTest")

SCSFExport scsf_SSTest(SCStudyGraphRef sc)
{
  if (sc.SetDefaults)
  {
    sc.GraphName = "SCTest";
    sc.AutoLoop = 1;    
    return;
  }
  
  // compute once per bar
  if (sc.GetBarHasClosedStatus(sc.Index) != BHCS_BAR_HAS_CLOSED)
    return;
  
  // make a screenshot, format is <symbol>.<barnumber>.png
  SCString _imageFileName;
  _imageFileName.Format("%s.%d.png", sc.Symbol.GetChars(), sc.Index);
  sc.SaveChartImageToFileExtended(sc.ChartNumber, _imageFileName, 0, 0, 0);
}

-- W