Bug report 4.5.1 fails to Load bars to variables 16 of 28 pairs

Capt.Z-Fort.Builder's avatar

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

  24 Nov 2022, 17:53
Bug report 4.5.1 fails to Load bars to variables 16 of 28 pairs

Hello Team,

I have the below code, to load 28 FOREX pairs to variables as private Bars. It works with no problem at 4.4.19 and all previous versions. But 4.5.1 report error as below screen shot.

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CurrencyStrengthValue : Indicator
    {
        [Parameter("GROUP A",       DefaultValue = "True",          Group = "Ver. 2.08"     )] public bool   GroupA     { get; set; }
        [Parameter("GROUP B",       DefaultValue = "True",          Group = "Ver. 2.08"     )] public bool   GroupB     { get; set; }
        
        [Output("USD", LineColor = "DDFF0005", Thickness = 1, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries USD { get; set; }
        [Output("EUR", LineColor = "DD1256FF", Thickness = 1, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries EUR { get; set; }
        [Output("GBP", LineColor = "DDB600FF", Thickness = 1, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries GBP { get; set; }
        [Output("CHF", LineColor = "DDC4C425", Thickness = 1, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries CHF { get; set; }
        [Output("AUD", LineColor = "DDCFA005", Thickness = 1, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries AUD { get; set; }
        [Output("NZD", LineColor = "DD00BF00", Thickness = 1, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries NZD { get; set; }
        [Output("CAD", LineColor = "DDFF21BF", Thickness = 1, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries CAD { get; set; }
        [Output("JPY", LineColor = "DDB3B3B3", Thickness = 1, PlotType = PlotType.DiscontinuousLine)] public IndicatorDataSeries JPY { get; set; }

        //Symbol Names
        private readonly string s_EURUSD = "EURUSD", s_EURGBP = "EURGBP", s_EURAUD = "EURAUD", s_EURNZD = "EURNZD", s_EURCAD = "EURCAD", s_EURCHF = "EURCHF", s_EURJPY = "EURJPY";
        private readonly string s_GBPUSD = "GBPUSD",                      s_GBPAUD = "GBPAUD", s_GBPNZD = "GBPNZD", s_GBPCAD = "GBPCAD", s_GBPCHF = "GBPCHF", s_GBPJPY = "GBPJPY";
        private readonly string s_AUDUSD = "AUDUSD",                                           s_AUDNZD = "AUDNZD", s_AUDCAD = "AUDCAD", s_AUDCHF = "AUDCHF", s_AUDJPY = "AUDJPY";
        private readonly string s_NZDUSD = "NZDUSD",                                                                s_NZDCAD = "NZDCAD", s_NZDCHF = "NZDCHF", s_NZDJPY = "NZDJPY";
        private readonly string s_USDCAD = "USDCAD",                                                                                     s_CADCHF = "CADCHF", s_CADJPY = "CADJPY";
        private readonly string s_USDCHF = "USDCHF",                                                                                                          s_CHFJPY = "CHFJPY";
        private readonly string s_USDJPY = "USDJPY";

        //Bars to load for Calculate : Defined at Initialize() 
        private Bars EURUSD, EURGBP, EURAUD, EURNZD, EURCAD, EURCHF, EURJPY;        
        private Bars GBPUSD,         GBPAUD, GBPNZD, GBPCAD, GBPCHF, GBPJPY;
        private Bars AUDUSD,                 AUDNZD, AUDCAD, AUDCHF, AUDJPY;
        private Bars NZDUSD,                         NZDCAD, NZDCHF, NZDJPY;
        private Bars USDCAD,                                 CADCHF, CADJPY;
        private Bars USDCHF,                                         CHFJPY;
        private Bars USDJPY;
        
        private TextBox tx_Load = new TextBox { BorderThickness = 0, VerticalAlignment = VerticalAlignment.Bottom, HorizontalAlignment = HorizontalAlignment.Center };

        protected override void Initialize()
        {
            //4.5.1 Can't load bars to variables 16 of 28 pairs got error 'Failed to get symbol 'AUDCHF': Symbol not found or has no quotes.'
            GetBarsForEachSymbols(Bars.TimeFrame);  
            
            Chart.AddControl(tx_Load);
            tx_Load.Text = "End if Initialize...\n";
            
        }


        public override void Calculate(int index) { }
     
        //GetBars for EachSymbol 
        private void GetBarsForEachSymbols(TimeFrame timeFrame)
        {
            EURUSD = MarketData.GetBars(timeFrame, s_EURUSD);  GBPUSD = MarketData.GetBars(timeFrame, s_GBPUSD);  AUDUSD = MarketData.GetBars(timeFrame, s_AUDUSD);  NZDUSD = MarketData.GetBars(timeFrame, s_NZDUSD);
            EURGBP = MarketData.GetBars(timeFrame, s_EURGBP);  GBPAUD = MarketData.GetBars(timeFrame, s_GBPAUD);  AUDNZD = MarketData.GetBars(timeFrame, s_AUDNZD);  NZDCAD = MarketData.GetBars(timeFrame, s_NZDCAD);
            EURAUD = MarketData.GetBars(timeFrame, s_EURAUD);  GBPNZD = MarketData.GetBars(timeFrame, s_GBPNZD);  AUDCAD = MarketData.GetBars(timeFrame, s_AUDCAD);  NZDCHF = MarketData.GetBars(timeFrame, s_NZDCHF);
            EURNZD = MarketData.GetBars(timeFrame, s_EURNZD);  GBPCAD = MarketData.GetBars(timeFrame, s_GBPCAD);  AUDCHF = MarketData.GetBars(timeFrame, s_AUDCHF);  NZDJPY = MarketData.GetBars(timeFrame, s_NZDJPY);
            EURCAD = MarketData.GetBars(timeFrame, s_EURCAD);  GBPCHF = MarketData.GetBars(timeFrame, s_GBPCHF);  AUDJPY = MarketData.GetBars(timeFrame, s_AUDJPY);  
            EURCHF = MarketData.GetBars(timeFrame, s_EURCHF);  GBPJPY = MarketData.GetBars(timeFrame, s_GBPJPY);                                                     USDCAD = MarketData.GetBars(timeFrame, s_USDCAD);
            EURJPY = MarketData.GetBars(timeFrame, s_EURJPY);                                                     USDCHF = MarketData.GetBars(timeFrame, s_USDCHF);  CADCHF = MarketData.GetBars(timeFrame, s_CADCHF);
                                                               USDJPY = MarketData.GetBars(timeFrame, s_USDJPY);  CHFJPY = MarketData.GetBars(timeFrame, s_CHFJPY);  CADJPY = MarketData.GetBars(timeFrame, s_CADJPY);
        }

    }

}
Capt.Z-Fort.Builder's avatar

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

  24 Nov 2022, 18:47
RE:

The issue had been identified now: add '#' ahead of color numbers at indicator Output setting, like below

[Output("USD", LineColor = "#DDFF0005"...

I can't imagine that a colour code error will bring trouble to Bars loading, and no error message when compiling.  The error message when running was totally not pointing to the actual place.

Xammo since: 23 Jun 2021;

  25 Nov 2022, 13:21

I had a similar issue which never got resolved/just left hanging but was in a bot and no colour involved surprised the # was the issue 

Unrelated but why doesn't the ctrader search forum work properly? I search for 'GetSymbol Problem' the exact title of the post and I get results from 2016

I search google for 'ctrader getsymbol problem' and my post is the first hit

I've given up searching in the forum even though it seems to use google search (and why do I have to scroll down past a load of sponsored ads when am searching in a forum?! been like this for many years!)