not loading : Monthly ATR Values and Series Count Value

Created at 05 Jan 2016, 10:46
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!
GoldnOil750's avatar

GoldnOil750

Joined 07.04.2015

not loading : Monthly ATR Values and Series Count Value
05 Jan 2016, 10:46


Dear Spotware,

the "GetSeries" method is not able to load the ""MONTHLY"" ATR and Series Count values of these "8" pairs (CADJPY, NZDJPY, EURCAD, GBPCAD, CADCHF, AUDCHF, NZDCHF, EURNZD, GBPNZD). 

 

For rest of the pairs like EURUSD, GBPUSD it is loading the values but not for these "8" pairs.  Have attached the "minimum" code also for you to run it on your system and cross check.

 

It goes on waiting for endless time, no matter on which Broker Platform I run it on and have tried it also on my local computer and on a VPS also. same result, the cBOT gets stucks on these 8 pairs on endless waiting.

Thank you

///S.Khan

 


////////////////////////////////////////////////////////////////////////////////////////////////////////////////

using System.Globalization;
using System.IO;
using System.Threading;
using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;


namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]

    public class zTestingMonthlyATRValues : Robot
    {

        //// USER INPUT //////////////////////////////////////////////////////////

        [Parameter("<----> Settings <---->")]
        public string temp50 { get; set; }

        [Parameter("30. Monthly-ATR, Period (1) = ", DefaultValue = 3, MinValue = 1)]
        public int p_ATR_Period_1 { get; set; }

        // END OF USER INPUT          /////


        //// GLOBAL VARIABLES ///////////////////////////////////////////////////

        // ATR INDICATOR INSTANCE /////////////////////
        private AverageTrueRange ATR_Indicator_1;
        //  END OF GLOBAL VARIABLES   /////


        //// ON START ////////////////////////////////////////////////////////////
        protected override void OnStart()
        {
            Print("");
            Print("cBOT Start Date & Time : " + Server.Time);

        }
        //END METHOD OnStart()

        //// ON BAR //////////////////////////////////////////////////////////////
        protected override void OnBar()
        {
            ///////
        }
        //END METHOD OnBar()

        //// ON TICK //////////////////////////////////////////////////////////////
        protected override void OnTick()
        {
            Get_Pair_ATR_Values();
            Get_Pair_Count_Values();
        }
        //END METHOD OnTick()


        //// ON STOP //////////////////////////////////////////////////////////////
        protected override void OnStop()
        {
            Print("");
            Print("Method : OnStop() '':   Date & time : " + Server.Time);
        }
        //END METHOD OnStop()

        //// GET ATR VALUES //////////////////////////////////////////////////////////////
        private void Get_Pair_ATR_Values()
        {
            double t_PipSize = 0, t_Result = 0;
            string tstr_Code;
            Symbol t_Symbol;

            Print("Start Method : Get_Pair_ATR_Values() ");

            //LOOP FOR 8 PAIRS
            for (int i = 0; i < 8; i++)
            {
                //GET PAIR SYMBOL 
                t_Symbol = Get_Pair_Symbol(i);

                //GET VALUES FROM SYMBOL
                tstr_Code = t_Symbol.Code.ToString();
                t_PipSize = t_Symbol.PipSize;

                // TIMEFRAME = MONTHLY
                var temp_1 = MarketData.GetSeries(tstr_Code, TimeFrame.Monthly);
                ATR_Indicator_1 = Indicators.AverageTrueRange(temp_1, p_ATR_Period_1, MovingAverageType.Simple);

                //RESULT
                t_Result = Math.Round(ATR_Indicator_1.Result.LastValue / t_PipSize, 0);

                //PRINT LOG
                Print(i + ". " + tstr_Code + ",  Monthly ATR Value =  " + t_Result);
            }
            //END FOR

            Print("END Method : Get_Pair_ATR_Values() ");
        }
        //END METHOD Get_Pair_ATR_Values()

        //// GET COUNT VALUES //////////////////////////////////////////////////////////////
        private void Get_Pair_Count_Values()
        {
            double t_PipSize = 0, t_Result = 0;
            string tstr_Code;
            Symbol t_Symbol;

            Print("Start Method : Get_Pair_Count_Values() ");

            //LOOP FOR 8 PAIRS
            for (int i = 0; i < 8; i++)
            {
                //GET PAIR SYMBOL 
                t_Symbol = Get_Pair_Symbol(i);

                //GET VALUES FROM SYMBOL
                tstr_Code = t_Symbol.Code.ToString();
                t_PipSize = t_Symbol.PipSize;

                // TIMEFRAME = MONTHLY
                var temp_1 = MarketData.GetSeries(tstr_Code, TimeFrame.Monthly);

                //COUNT RESULT
                t_Result = temp_1.Close.Count - 1;

                //PRINT LOG
                Print(i + ". " + tstr_Code + ",  Monthly COUNT Value =  " + t_Result);
            }
            //END FOR

            Print("END Method : Get_Pair_Count_Values() ");

        }
        //END METHOD Get_Pair_Count_Values()



        //// GET PAIR SYMBOL  /////////////////////////////////////////////////////
        private Symbol Get_Pair_Symbol(int t_Pair)
        {
            switch (t_Pair)
            {
                case 0:
                    return MarketData.GetSymbol("CADJPY");
                    break;
                case 1:
                    return MarketData.GetSymbol("NZDJPY");
                    break;
                case 2:
                    return MarketData.GetSymbol("EURCAD");
                    break;
                case 3:
                    return MarketData.GetSymbol("GBPCAD");
                    break;
                case 4:
                    return MarketData.GetSymbol("CADCHF");
                    break;
                case 5:
                    return MarketData.GetSymbol("AUDCHF");
                    break;
                case 6:
                    return MarketData.GetSymbol("NZDCHF");
                    break;
                case 7:
                    return MarketData.GetSymbol("EURNZD");
                    break;
                case 8:
                    return MarketData.GetSymbol("GBPNZD");
                    break;
            }
            //SWITCH

            return Symbol;
        }
        //END METHOD Get_Pair_Symbol

    }
    //END MAIN PUBLIC CLASS
}
//END MAIN cALGO ROBOT

 


@GoldnOil750
Replies

Spotware
05 Jan 2016, 23:36

Dear Trader,

Thank you for reporting it. We will investigate.


@Spotware

GoldnOil750
18 Jan 2016, 12:59 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Spotware said:

Dear Trader,

Thank you for reporting it. We will investigate.

 

 

Sir,

please do something; now for last 7 days EURUSD weekly prices are not loading......  it is really frustrating as "GetSymbol" doesn't work in backtesting and a whole week is wasted waiting for EURUSD weekly Open prices....

have attached screenshot also.....

 

thank you

///S.Khan

 


@GoldnOil750