V4.3.11 Bug, Read IndicatorDataSeries to String Variable Fails

Capt.Z-Fort.Builder's avatar

Capt.Z-Fort.Builder since: 03 Jun 2020;

  27 Sep 2022, 14:47
V4.3.11 Bug, Read IndicatorDataSeries to String Variable Fails

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.11). It was compiled by both .Net 4.x and .Net 6.x. The results are identical.

When I test the line with the problem, it seems only to occur in Initialize(), and in Calculate() it works fine. 

This bug should have been existing since 4.3.8 (as my first test of the cross-broker version). Please confirm if it can be repeated on your side.

Please advise,

Thanks.

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TestParameter : Indicator
    {
        [Output("1/2EURUSD,GBPUSD", LineColor = "DDFF0005", Thickness = 2, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries EGU { get; set; } 

        private Bars EURUSD, GBPUSD;
        private string s_EGU;

        protected override void Initialize()
        {
            EURUSD = MarketData.GetBars(TimeFrame.Hour, "EURUSD");  
            GBPUSD = MarketData.GetBars(TimeFrame.Hour, "GBPUSD");
            int i = Bars.Count-1;
            EGU[i] = (EURUSD.LastBar.Close + GBPUSD.LastBar.Close)/2;

            s_EGU = EGU[i].ToString("+0.0000;-0.0000;");    //Ver4.3.11.8681  Error without log message!!
                                                            //Ver4.1.17.50820 Runing correctly well...

            string msg = string.Format("Last EGU: {0}\n\n\n", s_EGU);
            Chart.DrawStaticText("debug", msg, VerticalAlignment.Bottom, HorizontalAlignment.Center, Color.FromHex("AAEEDDCC"));
        }

        public override void Calculate(int index) { }
    }
}
Capt.Z-Fort.Builder's avatar

Capt.Z-Fort.Builder since: 03 Jun 2020;

  26 Sep 2022, 13:35
This bug is not fixed yet...

Hello,

I've just rechecked this issue, it is still there of Version: 4.3.12.8775

Please advise if it will be fixed in the next update.

Thanks.

Capt.Z-Fort.Builder's avatar

Capt.Z-Fort.Builder since: 03 Jun 2020;

  21 Nov 2022, 11:23
RE:

This bug is now been fixed at ver. 4.4.19

Capt.Z-Fort.Builder said:

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.11). It was compiled by both .Net 4.x and .Net 6.x. The results are identical.

When I test the line with the problem, it seems only to occur in Initialize(), and in Calculate() it works fine. 

This bug should have been existing since 4.3.8 (as my first test of the cross-broker version). Please confirm if it can be repeated on your side.

Please advise,

Thanks.

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class TestParameter : Indicator
    {
        [Output("1/2EURUSD,GBPUSD", LineColor = "DDFF0005", Thickness = 2, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries EGU { get; set; } 

        private Bars EURUSD, GBPUSD;
        private string s_EGU;

        protected override void Initialize()
        {
            EURUSD = MarketData.GetBars(TimeFrame.Hour, "EURUSD");  
            GBPUSD = MarketData.GetBars(TimeFrame.Hour, "GBPUSD");
            int i = Bars.Count-1;
            EGU[i] = (EURUSD.LastBar.Close + GBPUSD.LastBar.Close)/2;

            s_EGU = EGU[i].ToString("+0.0000;-0.0000;");    //Ver4.3.11.8681  Error without log message!!
                                                            //Ver4.1.17.50820 Runing correctly well...

            string msg = string.Format("Last EGU: {0}\n\n\n", s_EGU);
            Chart.DrawStaticText("debug", msg, VerticalAlignment.Bottom, HorizontalAlignment.Center, Color.FromHex("AAEEDDCC"));
        }

        public override void Calculate(int index) { }
    }
}