Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 22:40:24 +0000



[Programming Help] - Using an external Library

View Count: 2203

[2021-12-02 23:11:51]
KylieV1618 - Posts: 67
Hi,

Can you show me the basics of how to use a library inside of a Sierra Chart plugin?
Using Remote Build option?

I want to use SDL_2, and SDL_2_MIXER.
The library contains 2 header files, which then reference like 8 or 9 dll files.
Ive tried importing the header files, and including all the dlls in the Data folder. That didn't work.

Ive tried importing all the seperate dlls seperately, that "worked", as in....it compiled with no errors.
But as soon as I tried to use the library or access any of the functions that are supposed to be available, I got an error.

So could you please guide me through how to add this library to a plugin I want to program?
Date Time Of Last Edit: 2021-12-02 23:13:11
[2021-12-02 23:58:15]
John - SC Support - Posts: 36309
You need to build your study locally to do what you want to accomplish. The instructions for this can be found in these overall instructions for how to build a custom study:
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
[2021-12-03 00:48:43]
KylieV1618 - Posts: 67
Yeah Im not well versed in C++ and I cant seem to get Visual Studio to do/build anything. Always just get errors and stuff.
Don't know enough to debug.

Thought it might be a bit easier by using Remote Build.
But I guess Ill have to do the drudgework of setting up my environment correctly. Ugh. The worst part about development is that haha
[2021-12-03 15:16:06]
John - SC Support - Posts: 36309
There is a post somewhere in this forum that users posted that gives information on how to put together Visual Studio to build a Sierra Chart study. Try searching for "Visual Studio" or items along those lines to see if you can find it.
For the most reliable, advanced, and zero cost futures order routing, use the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-12-03 21:30:47]
KylieV1618 - Posts: 67
I found the post. But it didnt really help mw.

my question is. I cant even build anything.

I dont know how to build a file.

I load a file into Visual Studio.cpp and the Build menu just says "Run Code Analysis on Solution", and clicking it does nothing.

And when I try to build through sierra chart with
Build With Visual C++ Release
then it says it cant find any of the files required.

Even though I clearly have Visual Studio 2019 installed and working. (although I guess Building doesnt work??)

I have VisualCCompile.bat downloaded and in the ACS_Source folder.


The other erros say it cant find vcvarsall.bat. (Visual studio 14? which I dont have)

And then all this other crap about environment variables, none of which it can find. NDEBUG USRDLL_d Zc.inline etc etc etc
[2021-12-04 18:35:30]
Sierra Chart Engineering - Posts: 104368
Update Sierra Chart, it has support for the newest version of Visual Studio. Instructions:

Software Download: Fast Update

The questions you are asking in post #1 are not within the scope of our support.
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, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2021-12-05 06:40:32]
Bet_More_Tim - Posts: 21
@KylieV1618 not sure if this will help, but this link here is something sierra used to have up on their website, not sure if it's up somewhere now or not, but I'll also link pictures for setting up visual studio such that you can create and compile sierra studies from the same place.


https://web.archive.org/web/20170705060950/https://www.sierrachart.com/index.php?page=doc/UsingVisualCPlusPlus.php <-- archived sierra page


https://imgur.com/a/BnbF5wY <-- should have multiple pictures showing setting up VS2019


Following the steps in the pictures there, writing your .cpp files script, and then build solution

btw I believe any and all other .dll you want to include should be placed in the ach_source folder, since that is our "include additional directories" selection... then after building the solution, all the things should then be in the sierra/data file, and you shouldn't have to do anything else other than open a chart and add custom study. Btw sierra might have to be restarted when you build a solution and it's open, in order for your new study to show up.

Hope this helps any
Date Time Of Last Edit: 2021-12-05 06:40:46
[2023-08-12 04:35:20]
Trade Dojo - Posts: 45
Also building study with Visual Studio, I have problem with cleaning the old DLL access denied. It's very inconvenient to restart SC every new compile.
LINK : fatal error LNK1104: cannot open file 'C:\SierraChart\Data\testDLL.dll'

I have sc.FreeDLL = 1 in the code from the get go.

Any one has solution for this?
Date Time Of Last Edit: 2023-08-12 04:37:44
[2023-10-13 15:18:17]
DayTraderEsad - Posts: 121
@User653970 - you should not have to restart SC everytime. Just use the remote build and study will be available in your custom studies....also add this as the stop of your code SCDLLName("ADD A UNIQUE NAME HERE");
[2023-10-13 15:21:31]
DayTraderEsad - Posts: 121
Here is jsut a quick example on what I mean --- I didnt add the entire study, but this is how I have all of mine start

#include "sierrachart.h"
SCDLLName("Custom Close Study");

SCSFExport scsf_MidpointMomentumShift(SCStudyInterfaceRef sc)
{
if (sc.SetDefaults)
{
// Set default study settings here.
sc.GraphName = "Midpoint Momentum Shift";
sc.StudyDescription =
"The Midpoint Momentum Shift study identifies potential shifts in market momentum by comparing the close of a bar with the midpoint of both the current and previous bars."
"<p>"
"1. **Green Arrow (Original Condition)**: This plots below the price bar when the previous bar's close is below its midpoint and the current bar's close is above its midpoint. This might suggest a positive momentum shift."
"<p>"
"2. **Red Arrow (Opposite Condition)**: This plots above the price bar when the previous bar's close is above its midpoint and the current bar's close is below its midpoint, suggesting a potential negative momentum shift."
"<p>"
"The study allows for adjustments in the arrow's distance from the bars through tick offsets, making it adaptable to various chart resolutions and preferences.";

sc.GraphRegion = 0; // Same region as price chart
sc.ValueFormat = 0;

sc.Subgraph[0].Name = "Original Condition";
sc.Subgraph[0].DrawStyle = DRAWSTYLE_TRIANGLE_UP;
sc.Subgraph[0].PrimaryColor = RGB(0, 78, 155); // Green for original condition
sc.Subgraph[0].LineWidth = 3; // Adjust as needed for visibility

sc.Subgraph[1].Name = "Opposite Condition";
sc.Subgraph[1].DrawStyle = DRAWSTYLE_TRIANGLE_DOWN;
sc.Subgraph[1].PrimaryColor = RGB(128, 0, 0); // Red for opposite condition
sc.Subgraph[1].LineWidth = 3; // Adjust as needed for visibility

// Add input settings for tick offsets
sc.Input[0].Name = "Original Condition Tick Offset";
sc.Input[0].SetInt(10); // Default value
sc.Input[0].SetIntLimits(1, 100); // You can adjust the limits as necessary

sc.Input[1].Name = "Opposite Condition Tick Offset";
sc.Input[1].SetInt(10); // Default value
sc.Input[1].SetIntLimits(1, 100); // You can adjust the limits as necessary

sc.AutoLoop = 1; // Automatic looping through bars
return;
}

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

Login

Login Page - Create Account