Login Page - Create Account

Support Board


Date/Time: Thu, 28 Nov 2024 14:02:16 +0000



ACSIL chart color functions

View Count: 637

[2023-04-29 14:15:09]
Marmany - Posts: 307
In the release notes for 2494 it states that:
"The following ACSIL member variables are no longer supported: sc.ChartBackgroundColor, sc.UseGlobalChartColors, sc.ScaleBorderColor. They have been replaced with the following ACSIL functions: sc.GetGraphicsSetting(), sc.SetGraphicsSetting(), sc.SetUseGlobalGraphicsSettings(). These new functions provide a full comprehensive access to all color and graphic settings of the chart. Documentation will be added for these new functions as soon as possible."
I would like to find out how to code the new functions prior to updating but can not locate them in the online documentation.
Please advise.
[2023-04-29 14:56:21]
Sierra_Chart Engineering - Posts: 17201
The documentation for these will be added in about a week but we are putting together an example now. We will post this in a few minutes.
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, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2023-04-29 15:10:21]
Sierra_Chart Engineering - Posts: 17201
SCSFExport scsf_GraphicsSettingsExample(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_SimpleMA = sc.Subgraph[0];

  // Set configuration variables

  if (sc.SetDefaults)
  {
    // Set defaults

    sc.GraphName = "Chart Graphics Settings Example";

    sc.StudyDescription =
"This example will change the color of the chart background, when the price is above a simple moving average. Add this study during a chart replay for a demonstration.";

    sc.GraphRegion = 0;

    Subgraph_SimpleMA.Name = "Simple Moving Average";
    Subgraph_SimpleMA.DrawStyle = DRAWSTYLE_LINE;
    Subgraph_SimpleMA.PrimaryColor = RGB(0, 255, 0);

    sc.AutoLoop = 0;

    return;
  }


  // Do data processing
  if (sc.IsFullRecalculation)
  {
    //Specify to use the chart graphic settings.
    sc.SetUseGlobalGraphicsSettings(sc.ChartNumber, false);
  }

  uint32_t Color = 0;
  uint32_t LineWidth = 0;
  SubgraphLineStyles LineStyle = LINESTYLE_UNSET;

  for (int BarIndex = sc.UpdateStartIndex; BarIndex < sc.ArraySize; BarIndex++)
  {
    // Simple moving average in the first subgraph
    sc.SimpleMovAvg(sc.Close, Subgraph_SimpleMA, BarIndex, 10);

    sc.GetGraphicsSetting(sc.ChartNumber, n_ACSIL::GRAPHICS_SETTING_CHART_BACKGROUND, Color, LineWidth, LineStyle);

    if (Subgraph_SimpleMA.Data[BarIndex] < sc.Close[BarIndex])
    {
      if (Color != RGB(255, 0, 0))
      {
        Color = RGB(255, 0, 0);
        sc.SetGraphicsSetting(sc.ChartNumber, n_ACSIL::GRAPHICS_SETTING_CHART_BACKGROUND, Color);
      }

    }
    else
    {
      if (Color != RGB(0, 0, 0))
      {
        Color = RGB(0, 0, 0);
        sc.SetGraphicsSetting(sc.ChartNumber, n_ACSIL::GRAPHICS_SETTING_CHART_BACKGROUND, Color);
      }
    }
  }


}

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, use the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2023-04-29 15:11:00
[2023-04-29 22:46:55]
Tony - Posts: 522
Works great! Thanks so much. The issue mentioned in This Post does not exist any more, same custom study (re-compiled after upgraded to 2497).
Date Time Of Last Edit: 2023-04-30 15:34:17

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

Login

Login Page - Create Account