Errors, bugs, questions - page 591

 
alexvd:

Let's go to servicedesk.

Please clarify how exactly were the services disconnected? Have you deleted (frozen) the services? Please attach logs of the problem agents.

The proxy settings in your logs are somewhat strange. Did you write the proxy settings in your agent configs? Please attach the common.ini of your manager.

It turns out I looked at the logs for yesterday...

Everything is fine.

 
TheXpert:

Next code:

Outputs:

2011.12.05 22:01:28 RectLabel (EURUSD,H1) pos = {12, 176314750}
2011.12.05 22:01:28 RectLabel (EURUSD,H1) other = {123, 456}

So, initialization list didn't work, there is rubbish in the structure. Is this a bug or not?

It is a bug of the compiler - it hasn't generated an error stating that the structure cannot be initialized that way (without copy constructor). Fixed. Thanks for the post.
 
I cannot understand deinitialization. Why message "Expert Advisor unloaded from pair ..." occurs twice?
//+------------------------------------------------------------------+
//|                                                   testDeinit.mq5 |
//|                        Copyright 2011, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2011, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"



//+------------------------------------------------------------------+
class CTest_Expert
  {

public:
                     CTest_Expert();
                    ~CTest_Expert() { Deinit(); }
                   
   void              Processing();
   void              Deinit();
   bool              StartTimer(int nCounSeconds);
   void              StopTimer();
   string   Exp_Symbol;
  };

   CTest_Expert arSymbols[];

//+------------------------------------------------------------------+
//| Конструктор                                                      |
//+------------------------------------------------------------------+
CTest_Expert::CTest_Expert()
  {

  }
//+------------------------------------------------------------------+
//| Функция удаления динамических объектов                           |
//+------------------------------------------------------------------+
void CTest_Expert::Deinit()
  {
  
   Print("Эксперт выгружен с пары "+Exp_Symbol);
   Comment("");

  }
//+------------------------------------------------------------------+
//|Инициализация таймера                                             |
//+------------------------------------------------------------------+
bool CTest_Expert::StartTimer(int nCountSeconds)
  {
   return(EventSetTimer(nCountSeconds));
  }
//+------------------------------------------------------------------+
//|Уничтожение таймера                                               |
//+------------------------------------------------------------------+

void CTest_Expert::StopTimer()
  {
      EventKillTimer();
  }

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   ArrayResize(arSymbols, 5);
   arSymbols[0].Exp_Symbol="0";
   arSymbols[1].Exp_Symbol="1";
   arSymbols[2].Exp_Symbol="2";
   arSymbols[3].Exp_Symbol="3";
   arSymbols[4].Exp_Symbol="4";
  
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
      int nSize=ArraySize(arSymbols);
      Print("nSize = " + IntegerToString(nSize));
      for(int i=0;i<nSize;i++)
        {
         Print("-------"+IntegerToString(i)+"--------");
         arSymbols[i].Deinit();
         Print("---------------");
        }
  
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
  
  }
//+------------------------------------------------------------------+

Result

2011.12.06 16:59:52 testDeinit (EURUSD,M5) 14:00:00 PM The Expert Advisor has been unloaded from pair 4
2011.12.06 16:59:52 testDeinit (EURUSD,M5) 14:02:00 PM testDeinit (EURUSD,M5) E.T.A. has been unloaded from pair 3
2011.12.06 16:59:52 testDeinit (EURUSD,M5) Downloaded from pair 2
2011.12.06 16:59:52 testDeinit (EURUSD,M5) Downloaded from pair 1
2011.12.06 16:59:52 testDeinit (EURUSD,M5) Ekspert unloaded from pair 0
2011.12.06 16:59:52 testDeinit (EURUSD,M5) ---------------
2011.12.06 16:59:52 testDeinit (EURUSD,M5) 14
2011.12.06 16:59:52 testDeinit (EURUSD,M5) -------4--------
2011.12.06 16:59:52 testDeinit (EURUSD,M5) ---------------
2011.12.06 16:59:51 testDeinit (EURUSD,M5) The expert is unloaded from pair 3
2011.12.06 16:59:51 testDeinit (EURUSD,M5) -------3--------
2011.12.06 16:59:51 testDeinit (EURUSD,M5) ---------------
2011.12.06 16:59:51 testDeinit (EURUSD,M5) The expert has been unloaded from pair 2
2011.12.06 16:59:51 testDeinit (EURUSD,M5) -------2--------
2011.12.06 16:59:51 testDeinit (EURUSD,M5) ---------------
2011.12.06 16:59:51 testDeinit (EURUSD,M5) The expert is unloaded from pair 1
2011.12.06 16:59:51 testDeinit (EURUSD,M5) -------1--------
2011.12.06 16:59:51 testDeinit (EURUSD,M5) ---------------
2011.12.06 16:59:51 testDeinit (EURUSD,M5) The expert is unloaded from pair 0
2011.12.06 16:59:51 testDeinit (EURUSD,M5) -------0--------
2011.12.06 16:59:51 testDeinit (EURUSD,M5) nSize = 5

 
Konstantin83:
I can't understand the deinitialisation. Why does the message "Expert unloaded from pair ..." happen twice?
                    ~CTest_Expert() { Deinit(); }

   CTest_Expert arSymbols[];

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
      int nSize=ArraySize(arSymbols);
      Print("nSize = " + IntegerToString(nSize));
      for(int i=0;i<nSize;i++)
        {
         Print("-------"+IntegerToString(i)+"--------");
         arSymbols[i].Deinit();
         Print("---------------");
        }
  
  }

First call from OnDeinit. Second call from destructor
 
mql5:
This is a bug in the compiler - it didn't generate an error saying that a structure cannot be initialized this way (without copy constructor). Fixed. Thanks for the post.

Uh, no. More details came up here.

In Help it says that simple structures may be copied as variables of simple types:

{
   Pos pos = {100, 100};
   Pos pos1 = pos; // копи конструктор
   pos = pos1; // копи оператор
}

Then why can't it be done in the initialization list? I don't want to explicitly define constructors, so as not to lose the initialization method used above.

Not critical in principle, just want to hear the final comment.

Документация по MQL5: Основы языка / Типы данных / Структуры и классы
Документация по MQL5: Основы языка / Типы данных / Структуры и классы
  • www.mql5.com
Основы языка / Типы данных / Структуры и классы - Документация по MQL5
 

I run the terminal with 12 windows open, it eats 325 MB of RAM.

Running the multi-currency Expert Advisor, terminal eats 990 Mb of memory. The Expert Advisor views 5-minute bars for the last 48 hours + uses "fractal" indicator. If I run only to trade on one symbol, it takes 400 Mb. Is this memory consumption normal when working with 12 symbols?

 
Konstantin83:
I am running a multi-currency Expert Advisor, the terminal eats 990 Mb of RAM. The expert looks through 5-minute bars for the last 48 hours + uses "fractal" indicator. If I run only to trade on one symbol, it takes 400 Mb. Is this memory consumption normal when working with 12 symbols?
Look at article Principles of Economical Recalculation of Indicators
 
I forgot to point out the fractal is a standard indicator + all calculations take place every five minutes
 
Konstantin83:
I forgot to mention the fractal is a standard indicator + all calculations take place every five minutes

How do developers know what you are doing and how you are doing it?
Try to clearly formulate and explain the root of the problem in your code.
Describe the problem in a technical way.

 
sergeev:

How can developers know what you are doing and how you are doing it?
Try to clearly formulate and highlight the essence of the problem in your code. at what conditions consumption starts to grow, make and show the log printout.
Describe the problem in a technical way.

I haven't paid attention to memory size before because it must not have been much. Yesterday and today I noticed system is lagging, opened task manager and there the terminal ate 900MB. Started looking. At startup 12 windows open - 325 MB, I put it on Expert Advisor window - 990 MB, so I thought it was eating up Expert Advisor. I have set "Charts - max bars per window" to unlimited. After I have changed it to 50 000 , I have launched the terminal and it weighs 110, then I have changed it to unlimited again. Now my Expert Advisor is 208 MB, i.e. it is OK.