Login Page - Create Account

Support Board


Date/Time: Tue, 26 Aug 2025 16:31:17 +0000



Post From: ACSIL study

[2025-06-10 08:16:59]
User431178 - Posts: 765

thank you for your help. I am still not there. Build works but no lines are projected. I made the changes that you suggested above. i am getting the following in the message log: 2025-06-09 21:00:06.631 | Chart: ESM25_FUT_CME [CB][M] 5 Min #7 | Study: Line Tool Projections | LineToolProjections: No line drawings found. Here is the code with changes you suggested.


const int DrawingCount = sc.GetUserDrawnDrawingsCount(sc.ChartNumber, ToolType);

should be as below, drawing type is not used here


const int DrawingCount = sc.GetUserDrawnDrawingsCount(sc.ChartNumber, 0);


if (!sc.GetUserDrawnChartDrawing(sc.ChartNumber, i, Tool, ToolType))
continue;

should be as below, you have things in the wrong order


if (!sc.GetUserDrawnChartDrawing(sc.ChartNumber, DRAWING_LINE, Tool, i))
continue;

If you want the last added / modified drawing you can dispense with the loop and simply enter -1 as the drawing index



if (!sc.GetUserDrawnChartDrawing(sc.ChartNumber, DRAWING_LINE, Tool, -1))
return;




#ifndef DRAWING_LINE
#define DRAWING_LINE 8
#endif

What is the purpose of this?

DRAWING_LINE is defined by DrawingTypeEnum and has a value of 1, you can simply use the existing enum value as the function argument.
When you cast your "DRAWING_LINE" to DrawingTypeEnum it becomes DrawingTypeEnum::DRAWING_RETRACEMENT.



// Plot subgraph values
Level1Up[sc.Index] = Levels[0];
Level2Up[sc.Index] = Levels[1];
Level3Up[sc.Index] = Levels[2];
Level1Down[sc.Index] = Levels[3];
Level2Down[sc.Index] = Levels[4];
Level3Down[sc.Index] = Levels[5];

You are using sc.AutoLoop = 0, therefore sc.Index would not be used, here you would need sc.ArraySize-1 instead (for example).


// Draw horizontal projected lines
for (int j = 0; j < 6; ++j)
{
s_UseTool LineTool;
LineTool.Clear();
LineTool.ChartNumber = sc.ChartNumber;
LineTool.DrawingType = DRAWING_LINE; // static_cast<DrawingTypeEnum>(DRAWING_LINE);
LineTool.BeginValue = Levels[j];
LineTool.BeginDateTime = sc.BaseDateTimeIn[sc.ArraySize - 1].GetAsDouble();
LineTool.Color = RGB(0, 255, 0);
LineTool.AddMethod = UTAM_ADD_ALWAYS;


You need to set an end date time and price for your line, both anchors are needed for it to be drawn.
You can also drop the static cast and just use the enum value when setting the drawing type.


if (ShowLevelValues.GetYesNo())
{
char Label[32];
snprintf(Label, sizeof(Label), "%.2f", Levels[j]);
LineTool.Text = Label;
}

Here you can use sc.FormatGraphValue instead or even


LineTool.Text.Format("%.2f", Levels[j])

It might pay to read some of the docs about drawing tools (and other items).
Using Drawing Tools From an Advanced Custom Study


One other thing, the way you have it written, every time the function is called (every chart update) it will add more lines to the chart, 6 on each call, on top of the previous ones.
You may wish to remember which line you have added lines for and/or remember the lines added and update them instead.
Persistent variables can help you with that.

ACSIL Interface Members - Functions: Persistent Variable Functions