Login Page - Create Account

Support Board


Date/Time: Sun, 16 Mar 2025 08:46:53 +0000



Rename and Compile an Existing SC Study for Distribution

View Count: 462

[2022-08-05 06:36:17]
User429065 - Posts: 128
In an effort to protect a proprietary combination of studies within the "Study Subgraphs Average - Multiple" study, I'm renaming it within the code using Notepad++, then trying to compile it using SC Remote or Visual Studio. Eventually, I'll protect it with a password. After several hours of following the "step-by-step instructions", I'm still not getting the required DLL file (see the attached result). Please advise, thank you very much!


#include "sierrachart.h"
#include "scstudyfunctions.h"

SCSFExport scsf_TrendeX(SCStudyInterfaceRef sc)
{
  SCSubgraphRef Subgraph_Average = sc.Subgraph[0];
  SCFloatArrayRef Array_SubgraphCount = sc.Subgraph[0].Arrays[0];

  if (sc.SetDefaults)
  {
    sc.GraphName = "TrendeX";

    sc.ValueFormat = 3;
    sc.AutoLoop = 0;//manual looping

    sc.CalculationPrecedence = LOW_PREC_LEVEL;

    Subgraph_Average.Name = "TrendeX";
    Subgraph_Average.DrawStyle = DRAWSTYLE_LINE;
    Subgraph_Average.LineWidth = 2;
    Subgraph_Average.PrimaryColor = RGB(0, 255, 0);
    Subgraph_Average.DrawZeros = false;

    int StudyReferenceIndex = 0;

    for (int InputIndex = 0; InputIndex < 40; InputIndex += 2)
    {
      StudyReferenceIndex++;
      sc.Input[InputIndex].Name.Format("Use Study Subgraph Reference %d", StudyReferenceIndex);
      sc.Input[InputIndex].SetYesNo(false);

      sc.Input[InputIndex + 1].Name.Format("Study Subgraph Reference %d", StudyReferenceIndex);
      sc.Input[InputIndex + 1].SetStudySubgraphValues(0, 0);

    }

    return;
  }

  int NumberUsedSubgraphs = 0;


  int CalculationStartIndex = sc.GetCalculationStartIndexForStudy();
  sc.EarliestUpdateSubgraphDataArrayIndex = CalculationStartIndex;

  for (int SubgraphIndex = 0; SubgraphIndex < 20; SubgraphIndex++)
  {
    if (!sc.Input[SubgraphIndex * 2].GetYesNo())
      continue;

    SCFloatArray StudyArray;
    sc.GetStudyArrayUsingID(sc.Input[SubgraphIndex * 2 + 1].GetStudyID(), sc.Input[SubgraphIndex * 2 + 1].GetSubgraphIndex(), StudyArray);

    if (StudyArray.GetArraySize() == 0)
      continue;

    NumberUsedSubgraphs++;

    for (int BarIndex = CalculationStartIndex; BarIndex < sc.ArraySize; BarIndex++)
    {
      if (NumberUsedSubgraphs == 1)
      {
        Subgraph_Average[BarIndex] = 0;
        Array_SubgraphCount[BarIndex] = 0;
      }

      //If the input subgraph is zero at this bar index, then do not include it in the average.
      if (StudyArray[BarIndex] == 0)
        continue;
      
      Subgraph_Average[BarIndex] += StudyArray[BarIndex];
      Array_SubgraphCount[BarIndex] += 1;
    }
  }

  for (int BarIndex = CalculationStartIndex; BarIndex < sc.ArraySize; BarIndex++)
  {
    if(Array_SubgraphCount[BarIndex] != 0)
      Subgraph_Average[BarIndex] /= Array_SubgraphCount[BarIndex];

  }  
}
Date Time Of Last Edit: 2022-08-05 06:38:36
imageBuild DLL.JPG / V - Attached On 2022-08-05 06:16:40 UTC - Size: 38.97 KB - 119 views
[2022-08-05 10:59:41]
Sierra_Chart Engineering - Posts: 18797
When you build this, we need to see the entire build output, so we can see the errors.
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: 2022-08-05 10:59:55
[2022-08-05 14:56:16]
John - SC Support - Posts: 38678
You are trying to build a header file, not a .cpp file. Also, the remote build option does not work with separate header files, you would need to have everything in the .cpp file. Refer to section 19.9 at the following link:
Advanced Custom Study Interface and Language (ACSIL): Step-By-Step Instructions to Create an Advanced Custom Study Function
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing

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

Login

Login Page - Create Account