Errors, bugs, questions - page 2556

 
Igor Makanu:

here@Vict helped to make an exception with exit to OS via macro substitution https://www.mql5.com/ru/forum/318246/page10#comment_12651045

, a generally workable solution, but... But it looks creepy and disgusting! )))

It's a real mess... To wrap return in a macro - you have to know a lot about perversions ) How to deal with such code then... We should at least make the name of the macro more descriptive, like TRY_OR_RETURN
 
Alexey Navoykov:
This is really something awful. You would have to know a lot about perversions to wrap return in a macro :) How to deal with such code then... We should at least make the name of the macro more descriptive - TRY_OR_RETURN, etc.

)))

I've seen how it looks and don't use it, I write it the old-fashioned way if(!myfunc()) return; in OnTick() - the code is all full of ifs ... looks pretty cute and funny too ))))

 

Forum on trading, automated trading systems and trading strategy testing

New version of MetaTrader 5 build 2085: Integration with Python and massive improvements in strategy tester

Andrey Barinov, 2019.09.06 06:25

Can you still explain why there is a warning in this code now?

The methods have different signatures...

class A
  {
   public:
                     A(void) {}
                    ~A(void) {}
      //===============
      void           Test(void) {}
      //===============
  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+  
class B : public A
  {
   public:
                     B(void) {}
                    ~B (void) {}
      //===============
      void           Test(int a) {}
      //===============
  };
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   B b;

   b.Test(); //deprecated behavior, hidden method calling will be disabled in a future MQL compiler versions
   b.Test(5);
//---
   return(INIT_SUCCEEDED);
  }

 

Forum on trading, automated trading systems and trading strategy testing

New version of MetaTrader 5 build 2085: Integration with Python and massive improvements in strategy tester

Andrey Barinov, 2019.09.06 06:11

Broken typename() in build 2136

Please fix it back.

enum eTest
  {
   TEST
  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   Alert(typename(eTest)); // eTest::eTest а правильно (и раньше так было) eTest
//---
   return(INIT_SUCCEEDED);
  }

typename


 
@Ilyas

This indicator crashes the system.
And with change of screen resolution and with flashing pixels and necessary reboot of computer.
Moreover if you don't call seemingly harmless function Crash() you won't crash.
Reproduced as follows:

  • run the indicator
  • start to change the timeframe until there are some lags
  • after that try to minimize MT5



Played this crash every time I did it ( 6-8 times)

Files:
AnyTF.mq5  10 kb
iCanvas.mqh  21 kb
 
it didn't crash on LTSC, logging error: MemoryException 4424265936 bytes not available, 0 heapmin result

it did crash, after a few more TF changes and the system just barely booted, the boot wheel went through 100 spins, thought it wouldn't boot, best not to check)
 
Fast235:
It didn't crash on LTSC, the following error in the log: MemoryException 4424265936 bytes not available, 0 heapmin result

i still crashed after a few more TF changes and the system just barely booted, the loading wheel went through 100 spins, i didn't think it would boot, better not to check it)

Yes, the crash is very hard. Best not to take any chances.
It's all about memory, of course.
If you clean up the memory like this:

int OnInit()
  {
   ChartSetInteger(0,CHART_FOREGROUND,false);
   if(erase)
      ChartSetInteger(0,CHART_SHOW,false);
   Canvas.Erase();
   Canvas.Comm("Идет загрузка всех тиков. Подождите пожалуйста");
   Canvas.Update();
   N=CopyTicks(_Symbol,ticks,COPY_TICKS_ALL,(TimeCurrent()-Weeks*7*24*60*60)*1000,INT_MAX);
   Print("Скачено "+string(N)+" тиков");
   if(N>0) N=CalculateNewTF(ticks,bars,TF);
   ArrayFree(ticks);
   Print("Сформировано "+string(N)+" баров");
   if(N>0) ShowBars(bars);
   Crash();
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
void OnDeinit(const int reason) 
  {
    ArrayFree(bars); 
    if(erase) ChartSetInteger(0,CHART_SHOW,true); 
  }

it doesn't crash either. Anyway, it did not work for me.
But when the TF is being changed, arrays must be automatically cleaned!

And I do not understand what does the Crash() function have to do without it, because it reads only information about indicators.
Perhaps, the execution of this function slows OnDeinit when changing the TF and that is why MT5 has no time to clear the memory.
We have had problems with asynchronous OnDeinit for a long time. It is not good! The system must not crash because of asynchrony...

 

Why when you scroll the chart with indicators the processor loads the core at 100%?

After all, the indicators have been calculated and drawn, according to the idea, only the load from memory should be.

 
Aleksey Vyazmikin:

Why when you scroll the chart with indicators the processor loads the core at 100%?

After all, the indicators are calculated and drawn, according to the idea, only the load from memory should be.

CPU load when rendering charts directly depends on graphics card performance.

On old laptops with weak cards or on servers without video cards/drivers there will inevitably be an instant but brief spike in CPU load.

And the CPU itself needs to be more powerful in order to eat up the increased requests without a trace.
 
Renat Fatkhullin:

CPU load when rendering charts is directly related to video card performance.

On older laptops with weak cards or on servers without video cards/drivers there will inevitably be an immediate but short jump in CPU load.

And the CPU itself needs to be more powerful to eat up the increased demands without a trace.

I'm talking about the FX-8350 processor and a Radeon HD 7950 graphics card. I don't get the feeling that the video card is loaded by MT5.