Errors, bugs, questions - page 2967

 
Artyom Trishkin:
Not initialising your variables is abnormal behaviour. Initialise it and there won't be such questions.

Completely FOR it.

But that doesn't mean that the bug is nowhere to be found ))). Just wanted to make sure everything was OK.

 
mktr8591:

Completely FOR it.

But that doesn't mean that the bug is nowhere to be found ))). Just wanted to make sure everything is OK.

It's most likely some kind of protection.
Since access to memory cells in mql is not available, I suppose that when accessing a variable, its rubbish value is randomly generated.
And if the variable is not initialized, then at debug probability of not finding your error increases many times ))
And the compiler most likely tells about it in warnings, that the variable is not initialized.

 
Roman:

This is most likely a kind of protection.
Since access to memory cells in mql is not available, I suppose that when a variable is accessed, its rubbish value is randomly generated.
And if the variable is not initialized, when debugging, the probability of not finding an error increases many times ))
And the compiler most likely tells about it in the warning that the variable is not initialized.

Or optimization. Since the variable is undefined, we may give it any value we want, for example, in a register.

 
JRandomTrader:

Or optimisation. Since the variable is not defined, we can give any value that is closest, in a register, for example.

Something like that, from my environment. Generation of course is not appropriate as I said, just a generalized assumption.

 

Decided to find out how much 2 agents in MQL5 Cloud Network service will earn in order to build an iron with a multi-core processor in the future. I added the agents using Agent Manager. Seems to have added them fine.

Agent Manager

Nothing seems to besuspicious... I logged into my MQL5.COM account. I have seen the created agents in "Agents" section in myAlpari. I also found two services, MetaTester-1 and MetaTester-2 in the task manager. But for half a day there is no tasks for agents. Everything is null. Why aren't the agents working?

Распределенные вычисления в сети MQL5 Cloud Network
Распределенные вычисления в сети MQL5 Cloud Network
  • cloud.mql5.com
Заработать деньги, продавая мощности своего компьютера для сети распределенных вычислений MQL5 Cloud Network
 
	 CList *deals_array = new CList;

         for(int i=0;i<10;i++)
         {
            RobotDeal *cobj = new RobotDeal;
            cobj.ticker = "ticker " +IntegerToString(i);
            deals_array.Add(cobj);
         }
         
         RobotDeal *cobj11 = new RobotDeal;
         cobj11.ticker = "ticker 11 ";
         deals_array.Add(cobj11);
         
         RobotDeal *cobj12 = new RobotDeal;
         cobj12.ticker = "ticker 12 ";
         deals_array.Add(cobj12);
         
         RobotDeal *cobj13 = new RobotDeal;
         cobj13.ticker = "ticker 13 ";
         deals_array.Add(cobj13);
         
         RobotDeal *cobj14 = new RobotDeal;
         cobj14.ticker = "ticker 14 ";
         deals_array.Add(cobj14);

         Print("Total: " + IntegerToString(deals_array.Total()));

         for(int i=0;i<deals_array.Total();i++)
           {
               RobotDeal *object=deals_array.GetNodeAtIndex(i);
               Print(object.ticker);
           }
         
         for(int i=0; i < 14; i++)
         {
            Print("remove # " + IntegerToString(i));
            RobotDeal *deal = deals_array.GetNodeAtIndex(i);
            
            if(CheckPointer(deal) != POINTER_INVALID)
            {
               Print("remove: " + deal.ticker);
               deals_array.Delete(i);
            }
         }

         for(int i=0;i<deals_array.Total();i++)
           {
               RobotDeal *object=deals_array.GetNodeAtIndex(i);
               Print(object.ticker);
           }

         Print("Total end: " + IntegerToString(deals_array.Total()));
class RobotDeal: public CObject
{
    public:

    string ticker;

    RobotDeal() {}
};

Can you tell me how to correctly delete items from the Clist? When I try to delete only half of them are deleted and the indexing goes wrong. I've tried every way. it doesn't work at all!


When executing this code it outputs the following, for example


Total: 14

ticker 0

ticker 1

ticker 2

ticker 3

ticker 4

ticker 5

ticker 6

ticker 7

ticker 8

ticker 9

ticker 11

ticker 12

ticker 13

ticker 14

remove # 0

remove: ticker 0

remove # 1

remove: ticker 2

remove # 2

remove: ticker 4

remove # 3

remove: ticker 6

remove # 4

remove: ticker 8

remove # 5

remove: ticker 11

remove # 6

remove: ticker 13

remove # 7

remove # 8

remove # 9

remove # 10

remove # 11

remove # 12

remove # 13

ticker 1

ticker 3

ticker 5

ticker 7

ticker 9

ticker 12

ticker 14

Total end: 7


 
Mihail Matkovskij:

Decided to find out how much 2 agents in MQL5 Cloud Network service will earn in order to build an iron with a multi-core processor in the future. I added the agents using Agent Manager. Seems to have added them fine.

Nothing seems to besuspicious... Logged into my MQL.COM account. I have seen the created agents in my account under "Agents". I also found two services, MetaTester-1 and MetaTester-2 in the task manager. But for half a day there is no tasks for agents. Everything is null. Why aren't the agents working?

What PR did you get for your agents? For example, there were tasks for PR180 on the 20th (especially in the morning).

 
Vladimir Karputov:

What PR agents did you get? For example, 20Chisla for PR180 were the tasks (especially in the morning).

I have PR agents of 119. I wonder how this affects it?

 
Mihail Matkovskij:

I have 119 PR agents. I wonder how that affects it?

I don't know for sure. I was just wondering.

 
DimaDDM:

Can you tell me how to correctly delete items from the Clist? When I try to delete only half of them are deleted and the indexing goes wrong. I've tried every way. It doesn't work at all!

You have an incorrect deletion! Your code:

        for(int i=0; i < 14; i++)
        {
            Print("remove # " + IntegerToString(i));
            RobotDeal *deal = deals_array.GetNodeAtIndex(i);
            
            if(CheckPointer(deal) != POINTER_INVALID)
            {
               Print("remove: " + deal.ticker);
               deals_array.Delete(i);
            }
         }

As you delete each item, the list gets smaller! That's why you have to do it like this:

        for(int i = deals_array.Total() - 1; i >= 0; i--)
        {
            Print("remove # " + IntegerToString(i));
            RobotDeal *deal = deals_array.GetNodeAtIndex(i);
            
            if(CheckPointer(deal) != POINTER_INVALID)
            {
               Print("remove: " + deal.ticker);
               deals_array.Delete(i);
            }
         }

Or even simpler:

deals_array.Clear();
Reason: