Problem with MarketData.GetSeries

Created at 23 May 2016, 15:43
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!
MA

Manuel_Meza

Joined 03.11.2014

Problem with MarketData.GetSeries
23 May 2016, 15:43


Since 1 week ago, I have problem with MarketData.GetSeries...

dont initileze my indicator...

I erase all to find the mistake and find that is MarketData.GetSeries... 

Please help me.

 

Thanks

 

Sorry for my english.

 

 

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.Linq;
using System.Text;
using System.Collections.Generic;
namespace cAlgo
{
    public class Listtype
    {
        public String Indice { get; set; }
        public String Par { get; set; }
        public String m10H1H4D1 { get; set; }
        public String RatioBeneficio { get; set; }
    }

    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Mrm1AnalisisRetrocesos10 : Indicator
    {

        string[] Pairs = 
        {
            "AUDCAD",
            "AUDJPY",
            "AUDNZD",
            "AUDUSD",
            "CADCHF",
            "CHFJPY",
            "DE30",
            "US30",
            "US500",
            "EURAUD",
            "EURCAD",
            "EURJPY",
            "EURGBP",
            "EURNZD",
            "EURUSD",
            "GBPAUD",
            "GBPCAD",
            "GBPCHF",
            "GBPJPY",
            "GBPNZD",
            "GBPUSD",
            "NZDUSD",
            "XAUUSD",
            "USDCAD",
            "USDCHF",
            "USDJPY",
            "XAGUSD",
            "EURCHF",
            "CADJPY",
            "USDMXN"
        };
        private MarketSeries[] m10MS = new MarketSeries[30];
        private MarketSeries[] m15MS = new MarketSeries[30];
        private MarketSeries[] m30MS = new MarketSeries[30];
        private MarketSeries[] h1MS = new MarketSeries[30];
        private MarketSeries[] h2MS = new MarketSeries[30];
        private MarketSeries[] h3MS = new MarketSeries[30];
        private MarketSeries[] h4MS = new MarketSeries[30];
        private MarketSeries[] h6MS = new MarketSeries[30];
        private MarketSeries[] h8MS = new MarketSeries[30];
        private MarketSeries[] h12MS = new MarketSeries[30];
        private MarketSeries[] D1MS = new MarketSeries[30];
        private MarketSeries[] D2MS = new MarketSeries[30];
        private MarketSeries[] D3MS = new MarketSeries[30];
        private MarketSeries[] W1MS = new MarketSeries[30];
        private MarketSeries[] M1MS = new MarketSeries[30];
        private Symbol[] symbol0 = new Symbol[30];


        protected override void Initialize()
        {

            for (int i = 0; i < Pairs.Length; i++)
            {
                //m10MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Minute10);
                //m15MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Minute15);
                //m30MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Minute30);
                //h1MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour);
                //h2MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour2);
                //h3MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour3);
                //h4MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour4);
                //h6MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour6);
                //h8MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour8);
                //h12MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour12);
                //D1MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Daily);
                //D2MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Day2);
                //D3MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Day3);
                //W1MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Weekly);
                M1MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Monthly);

            }
            var Table1 = new StringBuilder();
            Table1.AppendLine("Bid\tTime\tMillion\t\tAsk\tTime\tMillion");
            Table1.AppendLine("(Buys)\tago\tUnits\t\t(Sells)\tago\tUnits");
            Table1.AppendLine("----------------------------------------------------------------------------------");
            ChartObjects.DrawText("Header1", Table1.ToString(), StaticPosition.TopLeft, (Colors)Enum.Parse(typeof(Colors), "White", true));
        }

        public override void Calculate(int index)
        {

        }



    }
}


@Manuel_Meza
Replies

Spotware
23 May 2016, 16:18

Dear Trader,

We tried to reproduce your issue without success.

Could you please tell us if you receive any error codes/ exception messages?

In addition, we recommend you to try to optimize your code as so many requests to get Market Series of many symbols on many timeframes requires a fast internet connection and time to complete.

 


@Spotware

Manuel_Meza
23 May 2016, 16:53

Ok Spotware

I have only a loop... dont finish...

One week ago, its working fine... but now, I have this problem... I will try to reinstall cAlgo...

 

this indicator, its working on vps and my computer...

 

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.Linq;
using System.Text;
using System.Collections.Generic;
namespace cAlgo
{
    public class Listtype
    {
        public String Indice { get; set; }
        public String Par { get; set; }
        public String m10H1H4D1 { get; set; }
        public String RatioBeneficio { get; set; }
    }

    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Mrm1AnalisisRetrocesos10 : Indicator
    {

        string[] Pairs = 
        {
            "AUDCAD",
            "AUDJPY",
            "USDMXN"
        };
        private MarketSeries[] m10MS = new MarketSeries[30];
        private MarketSeries[] m15MS = new MarketSeries[30];
        private MarketSeries[] m30MS = new MarketSeries[30];
        private MarketSeries[] h1MS = new MarketSeries[30];
        private MarketSeries[] h2MS = new MarketSeries[30];
        private MarketSeries[] h3MS = new MarketSeries[30];
        private MarketSeries[] h4MS = new MarketSeries[30];
        private MarketSeries[] h6MS = new MarketSeries[30];
        private MarketSeries[] h8MS = new MarketSeries[30];
        private MarketSeries[] h12MS = new MarketSeries[30];
        private MarketSeries[] D1MS = new MarketSeries[30];
        private MarketSeries[] D2MS = new MarketSeries[30];
        private MarketSeries[] D3MS = new MarketSeries[30];
        private MarketSeries[] W1MS = new MarketSeries[30];
        private MarketSeries[] M1MS = new MarketSeries[30];
        private Symbol[] symbol0 = new Symbol[30];


        protected override void Initialize()
        {

            for (int i = 0; i < Pairs.Length; i++)
            {
                m10MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Minute10);
                m15MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Minute15);
                m30MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Minute30);
                h1MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour);
                h2MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour2);
                h3MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour3);
                h4MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour4);
                h6MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour6);
                h8MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour8);
                h12MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour12);
                D1MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Daily);
                D2MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Day2);
                D3MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Day3);
                W1MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Weekly);
                M1MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Monthly);

            }
            var Table1 = new StringBuilder();
            Table1.AppendLine("Bid\tTime\tMillion\t\tAsk\tTime\tMillion");
            Table1.AppendLine("(Buys)\tago\tUnits\t\t(Sells)\tago\tUnits");
            Table1.AppendLine("----------------------------------------------------------------------------------");
            ChartObjects.DrawText("Header1", Table1.ToString(), StaticPosition.TopLeft, (Colors)Enum.Parse(typeof(Colors), "White", true));
        }

        public override void Calculate(int index)
        {

        }



    }
}


@Manuel_Meza

Manuel_Meza
23 May 2016, 19:29

I still have problem... 

 

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
using System.Linq;
namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class Mrm1AnalisisRetrocesos10 : Indicator
    {

        string[] Pairs = 
        {
            "AUDCAD",
            "AUDJPY",
            "USDMXN"
        };

        private MarketSeries[] h3MS = new MarketSeries[30];


        protected override void Initialize()
        {

            for (int i = 0; i < Pairs.Length; i++)
                h3MS[i] = MarketData.GetSeries(Pairs[i], TimeFrame.Hour3);

        }

        public override void Calculate(int index)
        {
            ChartObjects.DrawText("1", "1: Hi", StaticPosition.TopLeft, Colors.Blue);
            ChartObjects.DrawText("2", "2: Hello", StaticPosition.TopRight, Colors.Blue);
            ChartObjects.DrawText("3", "3: Bye", StaticPosition.BottomLeft, Colors.Blue);
            ChartObjects.DrawText("4", "4: Usa", StaticPosition.TopLeft, Colors.Blue);
            ChartObjects.DrawText("5", "5: Mexico", StaticPosition.TopRight, Colors.Blue);
            ChartObjects.DrawText("6", "6: Tri", StaticPosition.BottomLeft, Colors.Blue);
        }
    }
}


@Manuel_Meza

Spotware
24 May 2016, 10:21

Dear Trader,

Could you please perform a clean installation of cTrader/cAlgo and try to run the code again?

You can find the steps on how to perform a clean installation of cTrader/cAlgo on the "Performing a clean installation of cTrader" section of our User support site.


@Spotware

Manuel_Meza
31 May 2016, 18:34

Thanks. I resolve the problem


@Manuel_Meza