fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Big problem: array out of range (3297,29)

    Bug Reports
    3
    6
    2130
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      Dieter last edited by

      Hallo Admin,

      • no red errors when compiling
      • no error message during the optimization
        But during trading, the EA is removed from the chart and the following error messages appear.

      II 0 18:40:16.761 Var2_2.1cr (GBPUSD.m,M5) Terminal has been closed
      NL 0 18:40:59.729 Myfxbook (CHFJPY.m,H1) log -- Myfxbook EA Version 1.63
      CJ 0 18:40:59.730 Myfxbook (CHFJPY.m,H1) log -- Show_Log mode: 1
      JK 0 18:40:59.744 Myfxbook (CHFJPY.m,H1) log -- Debug mode: 0
      NH 2 18:40:59.786 Var3_1.0 (AUDCAD.m,M5) array out of range in 'Var3_1.0.mq5' (3297,29)
      CD 2 18:40:59.799 Var3_1.0 (AUDCHF.m,M5) array out of range in 'Var3_1.0.mq5' (3297,29)
      QQ 2 18:41:20.235 Var3_1.0 (AUDCHF.m,M5) array out of range in 'Var3_1.0.mq5' (3297,29)
      HN 2 18:41:38.597 Var3_1.0 (AUDCAD.m,M5) array out of range in 'Var3_1.0.mq5' (3297,29)
      JH 0 18:41:56.0_1551120664363_mql5.JPG 195 Myfxbook (CHFJPY.m,H1) Statement uploaded successfully
      CQ 0 18:42:58.039 Var2_2.1cr (GBPUSD.m,M5) Terminal has been closed
      NJ 0 18:42:58.039 Var3_1.0 (EURUSD.m,M5) Terminal has been closed
      JL 0 18:43:02.359 Myfxbook (CHFJPY.m,H1) log -- Myfxbook EA Version 1.63

      Is the failture known and can you tell me why this is going on?

      D 1 Reply Last reply Reply Quote 1
      • D
        Dieter @Dieter last edited by

        // "Once per bar" model
        template<typename T1,typename T2,typename T3>
        class MDL_OncePerBar: public BlockCalls
        {
        public: /* Input Parameters /
        T1 Symbol;
        T2 Period;
        T3 PassMaxTimes;
        /
        Static Parameters */
        string tokens[];
        int passes[];
        datetime old_values[];
        datetime time[];
        virtual void callback(int r) {return;}

        public: /* Constructor */
        MDL_OncePerBar()
        {
        	Symbol = (string)CurrentSymbol();
        	Period = (ENUM_TIMEFRAMES)CurrentTimeframe();
        	PassMaxTimes = (int)1;
        }
        
        public: /* The main method */
        virtual void _execute_()
        {
        	// this is static for speed reasons
        	
        	bool next    = false;
        	string token = Symbol + IntegerToString(Period);
        	int index    = ArraySearch(tokens, token);
        	
        	if (index == -1)
        	{
        		index = ArraySize(tokens);
        		
        		ArrayResize(tokens, index + 1);
        		ArrayResize(old_values, index + 1);
        		ArrayResize(passes, index + 1);
        		
        		tokens[index] = token;
        		passes[index] = 0;
        		old_values[index] = 0;
        	}
        	
        	if (PassMaxTimes > 0)
        	{
        		CopyTime(Symbol, Period, 1, 1, time);
        		**datetime new_value = time[0];**
        	
        		if (new_value > old_values[index])
        		{
        			passes[index]++;
        	
        			if (passes[index] >= PassMaxTimes)
        			{
        				old_values[index]  = new_value;
        				passes[index] = 0;
        			}
        	
        			next = true;
        		}
        	}
        	
        	if (next) {_callback_(1);} else {_callback_(0);}
        }
        

        };

        1 Reply Last reply Reply Quote 1
        • D
          Dieter last edited by Dieter

          Hello,

          do you have any idea what is going on?

          0_1551790550624_Expert-Failture.JPG

          E 1 Reply Last reply Reply Quote 1
          • E
            eklonsousa @Dieter last edited by

            @dieter No solution yet?

            1 Reply Last reply Reply Quote 0
            • E
              eklonsousa last edited by

              @fxDreema any idea?

              1 Reply Last reply Reply Quote 0
              • F
                fxpim last edited by

                In which timeframe are you testing the EA and which timeframe does the once-per-bar block use in which the error occurs? I've dealt with this error multiple times.

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post

                Online Users

                J
                F
                G
                O
                Z
                M
                W
                N
                G
                H

                34
                Online

                146.7k
                Users

                22.4k
                Topics

                122.6k
                Posts

                Powered by NodeBB Forums | Contributors