aborted by timeout

Created at 29 Sep 2022, 07:29
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!
EY

eynt

Joined 08.05.2020

aborted by timeout
29 Sep 2022, 07:29


Hello

 

I've attached a simple indicator which loads bars until a specific date. This indicator will throw the following error on .net 6 once places on charts with a lot of data such as 10-range SpotCrude (and will not necessary will happen on charts with a little data such as 10-range EURGBP):

 

29/09/2022 07:28:16.955 | Indicator instance [LoadBarsTestInd, SpotCrude, Ra10] aborted by timeout.

 

 

Thanks

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(AccessRights = AccessRights.FullAccess)]
    public class LoadBarsTestInd : Indicator
    {
        [Parameter(DefaultValue = "Hello world!")]
        public string Message { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        protected override void Initialize()
        {
            DateTime dateTime = new DateTime(2022, 1, 1);

            Print("start " + Bars.OpenTimes[0]);

            LoadBars(dateTime);

            Print("finish" + Bars.OpenTimes[0]);
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = 
        }

        public bool LoadBars(DateTime requiredStartDate)
        {
            //AppendLogLog("LoadBars");
            //Print("LoadBars");


            bool result = false;

            while (Bars.OpenTimes[0] > requiredStartDate)
            {
                result = true;

                //AppendLogLog("Bars.OpenTimes[0]= " + Bars.OpenTimes[0]);
                //Print("Bars.OpenTimes[0]= " + Bars.OpenTimes[0]);

                int loadedCount = Bars.LoadMoreHistory();

                //AppendLogLog("loadedCount= " + loadedCount);
                //Print("loadedCount= " + loadedCount);

                if (loadedCount == 0)
                    break;
            }

            return (result);
        }
    }
}

 


@eynt
Replies

PanagiotisCharalampous
29 Sep 2022, 11:12

Hi yuval,

This is the normal behavior. Whenever new bars are loaded the indicator is reinitialized and the previous instance is aborted. You will see this message until all data is loaded.

Best Regards,

Panagiotis 

Join us on Telegram and Facebook


@PanagiotisCharalampous

eynt
29 Sep 2022, 22:09

RE:

This behavior causes my indicator to be suspended (red exclamation mark) and basically fail. Try-catch does not work either.

How can I fix/bypass that behavior?

 

Thanks

 


@eynt

eynt
04 Oct 2022, 11:56

RE: RE:

Hello

Anything new on the subject?


@eynt

PanagiotisChar
04 Oct 2022, 17:15

Hi yuval,

Check Go to Date indicator to see how this is handled there.

Aieden Technologies

Need Help? Join us on Telegram

 


@PanagiotisChar

eynt
05 Oct 2022, 20:19

RE:

Thank you

 

This indicator does load data without throwing errors, I will try to use this approach on my projects.

However, if I have several other indicators on my charts, each time GoToData get more data (which can be dozens of times if the date is far in the past) all the indicators are being reloaded again and again which can slows down the entire process of presenting the chart.

Is there a way to make other indicators load themselves only once - when the GoToData finishes getting data?


@eynt