Hello, I have same problem, before update to 4.2.20 version FindAllObjects work fine, but with update to 4.2.20 it seem to be unable to find HorizontalLine.
I have this code and it work well for finding HorizontalLines and with 4.2.20 FindAllObjects seems to be unable to locate any HorizontalLine.
Right now result of ChartObject[] ChartObjectsHor = Chart.FindAllObjects(ChartObjectType.HorizontalLine); is always empty ChartObjectsHor despite HorizontalLine is present..
using System;
using System.Linq;
using cAlgo.API;
using System.Collections.Generic;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class test : Robot
{
protected override void OnStart()
{
}
protected override void OnTick()
{
CreatePendingOrders();
}
bool CreatePendingOrders()
{
ChartObject[] ChartObjectsHor = Chart.FindAllObjects(ChartObjectType.HorizontalLine);
ChartHorizontalLine EvaluatedLine_Horizontal;
foreach (var Element in ChartObjectsHor)
{
EvaluatedLine_Horizontal = (ChartHorizontalLine)Element;
Print("Element Color ", EvaluatedLine_Horizontal.Color);
if (EvaluatedLine_Horizontal.Color == Color.FromHex("FFAA89C6"))
{
//do stuff
}
}
return true;
}
protected override void OnStop()
{
// Put your deinitialization logic here
}
}
}
beauchelain
17 Aug 2022, 21:53
RE:
Hello, I have same problem, before update to 4.2.20 version FindAllObjects work fine, but with update to 4.2.20 it seem to be unable to find HorizontalLine.
I have this code and it work well for finding HorizontalLines and with 4.2.20 FindAllObjects seems to be unable to locate any HorizontalLine.
Right now result of ChartObject[] ChartObjectsHor = Chart.FindAllObjects(ChartObjectType.HorizontalLine); is always empty ChartObjectsHor despite HorizontalLine is present..
@beauchelain