Login Page - Create Account

Support Board


Date/Time: Thu, 12 Jun 2025 08:06:37 +0000



[Programming Help] - Programming Help ACSIL

View Count: 847

[2022-11-07 00:36:46]
User183724 - Posts: 194
working though the ACSIL examples on SC website

Using Drawing Tools From an Advanced Custom Study

// Marker example

copied and pasted to NPP ... added #include "sierrachart.h" ... added SCDLLName("Marker example")

I received a list of errors when i attempted to Remote Build.

thanks


code starts below
-----------------------------------------------------------------------------------------------------------------------------
#include "sierrachart.h"

// Name of the custom study.
SCDLLName("Marker example")

// Marker example
s_UseTool Tool;
int UniqueLineNumber = 74191;//any random number.

Tool.Clear(); // Reset tool structure. Good practice but unnecessary in this case.
Tool.ChartNumber = sc.ChartNumber;

Tool.DrawingType = DRAWING_MARKER;
Tool.LineNumber = UniqueLineNumber +1;

BarIndex = max(0, sc.ArraySize - 35);

Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex];
Tool.BeginValue = sc.High[BarIndex];

Tool.Color = RGB(0,200,200);
Tool.AddMethod = UTAM_ADD_OR_ADJUST;

Tool.MarkerType = MARKER_X;
Tool.MarkerSize = 8;

Tool.LineWidth = 5;

sc.UseTool(Tool);

compiler errors start below
-----------------------------------------------------------------------------------------------------------------------

-- Starting remote build of Custom Studies Source files: Markerexample.cpp. 64-bit -- 18:21:30

Allow time for the server to compile the files and build the DLL.

The remote build did not succeed. Result:

Markerexample.cpp:10:1: error: 'Tool' does not name a type
10 | Tool.Clear(); // Reset tool structure. Good practice but unnecessary in this case.
| ^~~~
Markerexample.cpp:11:1: error: 'Tool' does not name a type
11 | Tool.ChartNumber = sc.ChartNumber;
| ^~~~
Markerexample.cpp:13:1: error: 'Tool' does not name a type
13 | Tool.DrawingType = DRAWING_MARKER;
| ^~~~
Markerexample.cpp:14:1: error: 'Tool' does not name a type
14 | Tool.LineNumber = UniqueLineNumber +1;
| ^~~~
Markerexample.cpp:16:1: error: 'BarIndex' does not name a type
16 | BarIndex = max(0, sc.ArraySize - 35);
| ^~~~~~~~
Markerexample.cpp:18:1: error: 'Tool' does not name a type
18 | Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex];
| ^~~~
Markerexample.cpp:19:1: error: 'Tool' does not name a type
19 | Tool.BeginValue = sc.High[BarIndex];
| ^~~~
Markerexample.cpp:21:1: error: 'Tool' does not name a type
21 | Tool.Color = RGB(0,200,200);
| ^~~~
Markerexample.cpp:22:1: error: 'Tool' does not name a type
22 | Tool.AddMethod = UTAM_ADD_OR_ADJUST;
| ^~~~
Markerexample.cpp:24:1: error: 'Tool' does not name a type
24 | Tool.MarkerType = MARKER_X;
| ^~~~
Markerexample.cpp:25:1: error: 'Tool' does not name a type
25 | Tool.MarkerSize = 8;
| ^~~~
Markerexample.cpp:27:1: error: 'Tool' does not name a type
27 | Tool.LineWidth = 5;
| ^~~~
Markerexample.cpp:29:1: error: 'sc' does not name a type; did you mean 's_sc'?
29 | sc.UseTool(Tool);
| ^~
| s_sc

-- End of Build -- 18:21:36
[2022-11-07 02:34:07]
User183724 - Posts: 194
i figured out part of my error... i simply copied the code and didn't make a study out of it. I re wrote the study including some of what is required to make it work.

code starts below
============================================================================================================================================

#include "sierrachart.h"

// Name of the custom study.
SCDLLName("Markerexample")

SCSFExport scsf_Markerexample(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    
    sc.GraphName = "Function";
    
    sc.AutoLoop = 1; // Automatic looping is enabled.

    
    return;
  }
  
// Marker example
s_UseTool Tool;
int UniqueLineNumber = 74191;//any random number.

Tool.Clear(); // Reset tool structure. Good practice but unnecessary in this case.
Tool.ChartNumber = sc.ChartNumber;

Tool.DrawingType = DRAWING_MARKER;
Tool.LineNumber = UniqueLineNumber +1;

BarIndex = max(0, sc.ArraySize - 35);

Tool.BeginDateTime = sc.BaseDateTimeIn[BarIndex];
Tool.BeginValue = sc.High[BarIndex];

Tool.Color = RGB(0,200,200);
Tool.AddMethod = UTAM_ADD_OR_ADJUST;

Tool.MarkerType = MARKER_X;
Tool.MarkerSize = 8;

Tool.LineWidth = 5;

s_sc.UseTool(Tool);

}



error starts here

=========================================================================================================================================================

-- Starting remote build of Custom Studies Source files: Markerexample.cpp. 64-bit -- 20:29:02

Allow time for the server to compile the files and build the DLL.

The remote build did not succeed. Result:

Markerexample.cpp: In function 'void scsf_Markerexample(SCStudyInterfaceRef)':
Markerexample.cpp:31:1: error: 'BarIndex' was not declared in this scope
31 | BarIndex = max(0, sc.ArraySize - 35);
| ^~~~~~~~
Markerexample.cpp:44:5: error: expected unqualified-id before '.' token
44 | s_sc.UseTool(Tool);
| ^

-- End of Build -- 20:29:08



still cant make it work but am closer
[2022-11-07 04:04:54]
User183724 - Posts: 194
i declared BarIndex as int BarIndex (0)

so I'm down to


Allow time for the server to compile the files and build the DLL.

The remote build did not succeed. Result:

Markerexample.cpp: In function 'void scsf_Markerexample(SCStudyInterfaceRef)':
Markerexample.cpp:49:5: error: expected unqualified-id before '.' token
49 | s_sc.UseTool(Tool);
| ^

-- End of Build -- 22:03:31


I don't know what this is or how to fix it.
[2022-11-07 08:25:56]
User431178 - Posts: 707
Change

s_sc.UseTool(Tool);

to

sc.UseTool(Tool);

That is all.

s_sc is the type of struct, your function needs to use 'sc', which is a reference passed into the function by SCStudyInterfaceRef sc.
SCStudyInterfaceRef is typedef alias for s_sc&, and sc is the variable name.
[2022-11-07 17:11:02]
User183724 - Posts: 194
thank you... that worked. the example on the site shows that with the s_sc.Usetool(tool) so I just copied it that way. I got a ways to go yet on understanding all the syntax and what all the functions do. Some of the examples ive found are older and I'm guessing theres been some changes made. anyway thanks again
[2022-11-07 17:39:00]
User183724 - Posts: 194
I just looked at the site again and i copied it wrong. the site doesnt have the s_ . something to watch for next time

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

Login

Login Page - Create Account