V4.3.9 Bug, FindAllObjects fails

Created at 02 Aug 2022, 01:59
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
Capt.Z-Fort.Builder's avatar

Capt.Z-Fort.Builder

Joined 03.06.2020

V4.3.9 Bug, FindAllObjects fails
02 Aug 2022, 01:59


Hello, 

I have the below code, it works well in ICMarkets cTrader (ver. 4.1.17) but does not display the correct result in cTrader Spotware (ver4.3.9). It was compiled in v4.1.17. I also tried to compile it in v4.3.9 with Framework 6.x.  The result is the same.

Please advise,

Thanks.

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class FindIcons : Robot
    {
        protected override void OnStart()
        {
            var Icons = Chart.FindAllObjects(ChartObjectType.Icon);
            string msg = string.Format("Icons.Count: {0}\n\n\n", Icons.Count().ToString());

            Chart.DrawStaticText("debug", msg, VerticalAlignment.Bottom, HorizontalAlignment.Center, Color.FromHex("AAEEDDCC"));

        }

        protected override void OnTick() {}

        protected override void OnStop() {}
    }
}


@Capt.Z-Fort.Builder
Replies

PanagiotisCharalampous
02 Aug 2022, 08:33

Hi TheNiatpac,

Thanks for reporting this. We will check it and fix it.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

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..

 

 

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

Capt.Z-Fort.Builder
31 Aug 2022, 14:45

This bug has been fixed at Spotware Ver 4.3.11.8681

Thank you.


@Capt.Z-Fort.Builder