Login Page - Create Account

Support Board


Date/Time: Thu, 17 Jul 2025 10:30:53 +0000



[Programming Help] - custome study

View Count: 76

[2025-07-15 23:00:44]
Rustam - Posts: 22
Hi I try to create a Custome Study via chat GPT and get this error message. Can someone tell me what I'm doing wrong?
Code :

#include "sierrachart.h"

SCDLLName("SMT Divergenz Linie")

SCSFExport void scsf_SMT_Divergenz_Linie(SCStudyInterfaceRef sc)
{
SCInputRef ChartNumA = sc.Input[0];
SCInputRef ChartNumB = sc.Input[1];
SCInputRef Lookback = sc.Input[2];
SCInputRef LineColor = sc.Input[3];

if (sc.SetDefaults)
{
sc.GraphName = "SMT Divergenz Linie";
sc.StudyDescription = "Zeichnet SMT Divergenzen zwischen zwei Charts ein";
sc.AutoLoop = 1;

ChartNumA.Name = "Chart Nummer A";
ChartNumA.SetInt(2);

ChartNumB.Name = "Chart Nummer B";
ChartNumB.SetInt(3);

Lookback.Name = "Lookback-Bars für Pivot";
Lookback.SetInt(3);
Lookback.SetIntLimits(1, 20);

LineColor.Name = "Linienfarbe";
LineColor.SetColor(RGB(255, 0, 0));

return;
}

int chartA = ChartNumA.GetInt();
int chartB = ChartNumB.GetInt();
int lb = Lookback.GetInt();
COLORREF color = LineColor.GetColor();

// Sicherheitsprüfung
if (sc.Index < lb || sc.Index + lb >= sc.ArraySize)
return;

SCFloatArray highA, lowA, highB, lowB;

sc.GetChartBaseData(chartA, SC_HIGH, highA);
sc.GetChartBaseData(chartA, SC_LOW, lowA);
sc.GetChartBaseData(chartB, SC_HIGH, highB);
sc.GetChartBaseData(chartB, SC_LOW, lowB);

if (highA.GetArraySize() == 0 || highB.GetArraySize() == 0)
return;

// Swing High
bool isHighA = sc.High[sc.Index] > sc.High[sc.Index - lb] && sc.High[sc.Index] > sc.High[sc.Index + lb];
bool isHighB = highB[sc.Index] > highB[sc.Index - lb] && highB[sc.Index] > highB[sc.Index + lb];

if (isHighA && isHighB)
{
float diffA = sc.High[sc.Index] - sc.High[sc.Index - lb];
float diffB = highB[sc.Index] - highB[sc.Index - lb];

if ((diffA > 0 && diffB < 0) || (diffA < 0 && diffB > 0))
{
s_UseTool tool;
tool.Clear();
tool.ChartNumber = sc.ChartNumber;
tool.DrawingType = DRAWING_LINE;
tool.BeginIndex = sc.Index - lb;
tool.EndIndex = sc.Index;
tool.BeginValue = sc.High[sc.Index - lb];
tool.EndValue = sc.High[sc.Index];
tool.Color = color;
tool.LineWidth = 2;
tool.Text = "SMT High Divergenz";
tool.AddMethod = UTAM_ADD_ALWAYS;
sc.UseTool(tool);
}
}

// Swing Low
bool isLowA = sc.Low[sc.Index] < sc.Low[sc.Index - lb] && sc.Low[sc.Index] < sc.Low[sc.Index + lb];
bool isLowB = lowB[sc.Index] < lowB[sc.Index - lb] && lowB[sc.Index] < lowB[sc.Index + lb];

if (isLowA && isLowB)
{
float diffA = sc.Low[sc.Index] - sc.Low[sc.Index - lb];
float diffB = lowB[sc.Index] - lowB[sc.Index - lb];

if ((diffA < 0 && diffB > 0) || (diffA > 0 && diffB < 0))
{
s_UseTool tool;
tool.Clear();
tool.ChartNumber = sc.ChartNumber;
tool.DrawingType = DRAWING_LINE;
tool.BeginIndex = sc.Index - lb;
tool.EndIndex = sc.Index;
tool.BeginValue = sc.Low[sc.Index - lb];
tool.EndValue = sc.Low[sc.Index];
tool.Color = color;
tool.LineWidth = 2;
tool.Text = "SMT Low Divergenz";
tool.AddMethod = UTAM_ADD_ALWAYS;
sc.UseTool(tool);
}
}
}



i get this error, sorry it is in german:

-- Starting build of Custom Studies Source files: SMT_Divergenz_Linie_clean.cpp. -- 00:53:32

C:\WINDOWS\system32\cmd.exe /C "C:\SierraChartNXT\ACS_Source\VisualCCompile.Bat"


C:\SierraChartNXT\ACS_Source>call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.14.9
** Copyright (c) 2025 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
SMT_Divergenz_Linie_clean.cpp
C:\SierraChartNXT\ACS_Source\SMT_Divergenz_Linie_clean.cpp(5): error C2062: "void"-Typ unerwartet
C:\SierraChartNXT\ACS_Source\SMT_Divergenz_Linie_clean.cpp(6): error C2143: Syntaxfehler: Es fehlt ";" vor "{"
C:\SierraChartNXT\ACS_Source\SMT_Divergenz_Linie_clean.cpp(6): error C2447: "{": Funktionsheader fehlt - Parameterliste im alten Stil?
-- End of Build -- 00:53:34
[2025-07-16 02:37:11]
Tony - Posts: 615
The ACSIL codes generated by ChatGPT is always a total mess, it always created functions and variables and do not exist.

They are not usable 99.9% of the time.
[2025-07-16 04:01:25]
cmet - Posts: 710
They are not usable 99.9% of the time.
= user error

Your success with AI and ACSIL (or any other job) is going to depend on your ability to prompt using clear instructions about what you're trying to accomplish. It ain't push button.

Did you give GPT those errors? It is extremely capable of debugging based on compiler errors.

Try that first.
[2025-07-16 04:09:15]
Rustam - Posts: 22
I gave chat gpt the errors, but apparently he doesn't get rid of the error. Chatgpt writes that the sierrachart.h file must be faulty. I looked in the forum and a user had a similar error with chat gpt and you had helped him. I then used his code and it worked. So the error cannot be due to sierrachart.h
[2025-07-16 08:46:55]
User431178 - Posts: 741
This is wrong, the void here is causing the error C2062: unexpected type 'void'

SCSFExport void scsf_SMT_Divergenz_Linie(SCStudyInterfaceRef sc)

Change it to this and problem solved.

SCSFExport scsf_SMT_Divergenz_Linie(SCStudyInterfaceRef sc)

Here is a link to another thread where the exact same problem is mentioned/solved - error code C2062, C2143 & C2447


I gave chat gpt the errors, but apparently he doesn't get rid of the error. Chatgpt writes that the sierrachart.h file must be faulty. I looked in the forum and a user had a similar error with chat gpt and you had helped him. I then used his code and it worked. So the error cannot be due to sierrachart.h

Here is chatGPT finding the solution, after a few attempts.

https://chatgpt.com/share/687764a1-cb24-8004-b2f4-6b13b3ac7b7d
[2025-07-16 10:32:44]
Rustam - Posts: 22
I managed to get him to create a study for me, had to delete void, but the divergences between ES and NQ are not displayed

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

Login

Login Page - Create Account