Login Page - Create Account

Support Board


Date/Time: Thu, 18 Apr 2024 10:30:13 +0000



ACSIL Chart drawings not visible - What am I doing wrong?

View Count: 1134

[2015-08-16 07:41:32]
Jayturn - Posts: 15
I am attempting to plot a marker on a reference chart and the drawings are being registered in the "Manage Chart Drawings Window" but don't appear visible in my chart. Below is the code I am using and an attachment showing the chart drawings that are registered:



// Only trigger on first bar of the session.
if (firstBarOfSession)
{
// Register the Tool object.
s_UseTool Tool;
// This is the referenced chart number.
refChartIndex = sc.GetPersistentInt(1);
refMarker = sc.GetPersistentInt(7);

sc.SetPersistentInt(7, 8579274);

// Get the trading date we are working with.
SCDateTime prevDaySessionEnd = sc.GetTradingDayDate(sc.BaseDateTimeIn[sc.Index - 1]);
// Get the open time for the prev day.
SCDateTime prevDaySessionStart = sc.GetTradingDayStartDateTimeOfBar(prevDaySessionEnd);

// Define the subgraphs we will be working with.
SCGraphData refChartGraphData;
// Get the base data for the reference chart.
sc.GetChartBaseData(refChartIndex, refChartGraphData);
// Define the Time Bar Arrays we require.
SCDateTimeArray refChartDateArray;

// Build the DateTime arrays we need.
sc.GetChartDateTimeArray(refChartIndex, refChartDateArray);

// If the GraphData Array is empty return.
if (refChartGraphData[SC_LAST].GetArraySize() > 0)
{
// Define the first and last bars of the session for the reference chart.
refChartEndBar = sc.GetNearestMatchForDateTimeIndex(refChartIndex, sc.Index - 1);
refChartStartBar = sc.GetNearestMatchForSCDateTime(refChartIndex, prevDaySessionStart);

// Loop through the bars to generate values we need.
for (int Index = refChartStartBar; Index <= refChartEndBar; Index++)
{
// Another condition here prevents every bar from being added but removed for code sample.
// Clear the Tool.
   Tool.Clear();

   // Define the Tool settings.
   Tool.ChartNumber = refChartIndex;
// AddUserDrawnDrawing to allow drawings to appear on referenced charts.
   Tool.AddAsUserDrawnDrawing = 1;
   Tool.DrawingType = DRAWING_MARKER;
   Tool.MarkerType = MARKER_X;
   Tool.MarkerSize = 8;
   Tool.LineWidth = 5;
   // Add a new drawing to the existing line number.
   Tool.AddMethod = UTAM_ADD_ALWAYS;
   // Set the start DateTime of the drawing.
   Tool.BeginIndex = Index;
   Tool.EndIndex = Index;
   Tool.BeginValue = refChartGraphData[SC_HIGH][Index];
   Tool.EndValue = refChartGraphData[SC_HIGH][Index];
   Tool.Region = 1;
   Tool.Color = RGB(255, 0, 255);

   // Set the Tool line number to be persistent.
Tool.LineNumber = refMarker;
          
   // Add the marker to the chart.
   sc.UseTool(Tool);

}
}
}

Can someone please let me know where I am going wrong? I suspect a default setting is missing or something but haven't been able to figure out what.
imageRefernceMarkers.PNG / V - Attached On 2015-08-16 07:39:51 UTC - Size: 145.8 KB - 320 views
[2015-08-16 11:34:13]
Jayturn - Posts: 15
It turned out to be the region set incorrectly. Changed to Tool.Region = 0 and the markers appear as expected.

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

Login

Login Page - Create Account