ChartTrendLineAdapter
Created at 31 May 2022, 18:07
ChartTrendLineAdapter
31 May 2022, 18:07
Hi,
I am creating a bot so I can export bars within two trend lines. Here is my code to read TrendLine objects:
var trendLineObjects = Chart.Objects.Where(chartObject => chartObject.ObjectType == ChartObjectType.TrendLine).ToList();
if (trendLineObjects != null)
{
var l1 = trendLineObjects[0];
var l2 = trendLineObjects[1];
// ChartTrendLineAdapter
var exportItem = CreateExportItem((ChartTrendLine)l1, (ChartTrendLine)l2);
SaveExportItem(exportItem);
}
I have got two trend line objects on the chart for the sake of testing.
When I try to cast the l1 to ChartTrendLine type I get cast exception. After debugging I realized type of l1 object is ChartTrendLineAdapter hence casting is not possible. See the image below:
And I cannot cast it to ChartTrendLineAdapter despite having a reference to CtraderAutomate 1.0.1
I am using .NET 6 version.
What am I missing?
amusleh
01 Jun 2022, 10:28
Hi,
This works fine for me:
@amusleh