Bug report 5.0.36 - MarketData.GetBars disorder running steps

Created at 30 Sep 2024, 12:00
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's avatar

Capt.Z

Joined 28.07.2022

Bug report 5.0.36 - MarketData.GetBars disorder running steps
30 Sep 2024, 12:00


Hello,

My cTrader official version upgraded to 5.0.36 and encountered an error. The code is supposed to run as ICM 4.9.2 version in green.

I have attached the code FYI. Please advise!

Thanks.

using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using cAlgo.API;
using cAlgo.API.Internals;


namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class CurrencyStrengthProject : Indicator
    {
        private Bars BarsD1;
        private bool b_Cal=true;

        protected override void Initialize()
        {
            System.Diagnostics.Debugger.Launch();

            if (LoadDailyBar()) { Print("This line should be printed before Calculate() start: Initialize() - End"); }
        }

        public override void Calculate(int index)
        {
            if (b_Cal) { Print("Calculate() started"); b_Cal=false; }   	//Run only once
        }

        private bool LoadDailyBar()             							//Load DailyBar
        {
            BarsD1 = MarketData.GetBars(TimeFrame.Daily, Bars.SymbolName);	//Exception occurs here, it jumps to Calculate()
            Print("This line should be printed before Calculate() start: " + BarsD1.SymbolName + " - " + BarsD1.Count );
            return true;
        }

    }

}

@Capt.Z
Replies

jumel.donatien
01 Oct 2024, 17:38

Good morning, I have exactly the same problem since version 5.0.32. Thanks to the cTrader team for resolving this issue.. I can't use my custom indicators anymore..


@jumel.donatien