Login Page - Create Account

Support Board


Date/Time: Mon, 16 Sep 2024 07:07:31 +0000



Post From: ACSIL - how to delete (ACSIL) user drawings when time frame is changed?

[2013-07-23 07:13:28]
User11748 - Posts: 14
Thanks, Kiwi, for this suggestion. :) But I am afraid that it does not solve the issue.

1. I am not sure that this function applies to ACSIL user drawings. Documentation of the function says that "it is not possible to delete user drawn chart drawings.", but it not clear whether it refers to "real" user drawings or ACSIL user drawings.

2. By the way, I have the feeling that one sentence of the documentation of this function is erroneous: "When a study is removed from the chart, or when it is recalculated, and it has chart drawings added with sc.UseTool(), these chart drawings are automatically deleted from the chart." I think that it does not apply to ACSIL drawings declared as user drawings (Tool.AddAdUserDrawnDrawing = 1).

3. Anyway, I tried to use it.

if ( sc.LastCallToFunction ) {
int res = sc.DeleteLineOrText(sc.ChartNumber, TOOL_DELETE_ALL, 0);
}

This code remains useless this sc.LastCallToFunction is not switched to true when the study is recalculated following a change of time frame.

I tried the following:

if ( sc.Index == 0 ) {
int res = sc.DeleteLineOrText(sc.ChartNumber, TOOL_DELETE_ALL, 0);
SCString buffer; buffer.Format("sc.Index == 0 ; res = %i", res); sc.AddMessageToLog(buffer, 1);
}

When the study is recalculated, the "old" drawings do not disappear (same behaviour that the image previously posted) and the value returned by sc.DeleteLineOrText is 0. I guess that when sc.Index == 0 (beginning of the recalculation), the study has already lost track of the "old" drawings (which, however, stay on the chart).

Thanks again for your help!

Nicolas

PS - Reminder of the question for SC team, in case you notice the thread at this stage. I have a study which creates ACSIL user drawings (Tool.AddAsUserDrawnDrawing = 1). How is it possible to programmatically delete them when the timeframe is changed (sc.LastCallToFunction is useless in this case) before the study is recalculated, in order to avoid having 2 sets of drawings on the chart (the old ones and the new ones). Minimal 40-line code and screenshot above. Thanks! :)
Date Time Of Last Edit: 2013-07-23 07:14:55