V4.3.11 Bug, Read IndicatorDataSeries to String Variable Fails

Created at 31 Aug 2022, 22: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!
Capt.Z-Fort.Builder's avatar

Capt.Z-Fort.Builder

Joined 03.06.2020

V4.3.11 Bug, Read IndicatorDataSeries to String Variable Fails
31 Aug 2022, 22:29


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
Replies

Capt.Z-Fort.Builder
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

Capt.Z-Fort.Builder
21 Nov 2022, 11:23 ( Updated at: 21 Dec 2023, 09: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) { }
    }
}

 

 


@Capt.Z-Fort.Builder