Login Page - Create Account

Support Board


Date/Time: Fri, 27 Dec 2024 00:32:41 +0000



sc.DeleteACSChartDrawing Not working-on multiple instances of study different charts.

View Count: 886

[2016-04-01 23:28:00]
enemyspy - Posts: 306
I have encountered a problem with this function- sc.DeleteACSChartDrawing() - under circumstances where 2 different charts are either replaying or in live trading situations.
I have abbreviated the code below with comments trying to explain as I go along. Tried to keep it as brief as possible.
No global variables and the struct is declared inside the study function.

struct Line{unsigned int LineNum; int a; int b; float c; float d; int y;}
static std:: vector<Line> LineStorage;
int LineIndex = Line.size();
Line Temp; LineStorage.push_back(Temp);

//fast forward through irrelevant processing that populates vars in the vector. Pick back up where we use the usetool.

sc.UseTool(tool); LineStorage[LineIndex].LineNum= tool.LineNumber;

//everything works fine here and shows up properly in the Line Members on the debugger.
//here is the part where we run into trouble in cases where there are multiple instances of the study feeding data in real time or replay.

for(int i= 0; i<LineStorage.size();++i)
{
if(/*something happens*/)
{
sc.DeleteACSChartDrawing(0, TOOL_DELETE_CHARTDRAWING, LineStorage[i].LineNum );
//Also tried:
sc.DeleteACSChartDrawing(sc.ChartNumber, TOOL_DELETE_CHARTDRAWING, LineStorage[i].LineNum );

//both the above work - but ONLY when A SINGLE INSTANCE of the study is being used in SierraChart.

LineStorage.erase(LineStorage.begin()+i);
}
}

Date Time Of Last Edit: 2016-04-01 23:32:47
[2016-04-03 23:22:09]
Sierra Chart Engineering - Posts: 104368
We can see you have edited this posting and at this point it is not clear what you are trying to describe.

Furthermore, we had a look at the sc.DeleteACSChartDrawing function. It is very simple and deletes the drawings with the specified LineNumber. It is impossible for there to be anything that can go wrong with it. It just cannot happen.

Therefore, the problem must be with your own code.
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
[2016-04-04 01:09:52]
enemyspy - Posts: 306
I generally assume that Bugs are a result of my own code. I was scratching my head for a very long time trying to figure out why it works flawlessly when only one instance of the study is running. I am wondering what within my code would make a difference when a second instance on a different chart is open.

The only thing I can think as if multiple instances are sharing the same Data structure. Data records for the Tool are being stored in this Data Structure.

struct Records{a;b;c;};
static std::vector<Records> DrawingRecords;
This Data structure is declared inside the study function, and all data is pushed into the structs within the vector. The way the above is declared would both instances be sharing a single data structure?
[2016-04-04 01:18:38]
enemyspy - Posts: 306
But I don't think that is even the problem because, the tool is drawing correctly on both charts when multiple instances are open. I have made sure to have the it auto assign the Line Number to storage as well.
[2016-04-04 01:23:52]
Sierra Chart Engineering - Posts: 104368
This is shared among all instances of the study:
static std::vector<Records> DrawingRecords;
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
[2016-04-04 05:57:40]
enemyspy - Posts: 306
ok it is fixed now. Took a while to figure out how to implement the persistence for this properly, but all the documentation was there.
Thank you.

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

Login

Login Page - Create Account