Login Page - Create Account

Support Board


Date/Time: Fri, 27 Dec 2024 16:19:31 +0000



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

[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