Errors, bugs, questions - page 1506

 
DV2010:

Please forgive any incomplete information.

1. the information is in the Log tab:

2. The indicator being tested for removal is the standard Bollinger Bands:

- the indicator file is located at C:\Program Files\Alpari Limited MT5\MQL5\Indicators\Examples\BB.ex5;

- The compiled file is added to the chart manually;

- both files are attached to this post.

3. Full Expert Advisor code that removes the indicator and on which the bug is detected:

   void OnInit(){
      ChartIndicatorDelete(0,0,"Bollinger Bands");
   } 

Test result:

After dragging such an "Expert Advisor" (in the application - DeleteInd.ex5) on the chart

Bollinger Bands added manually to the chart are deleted but the chart is not scaled after that when chart size changes.

Thank you for such a detailed and well formatted question (no one has written like this in a long time!).

What I have going on is this:

  1. I manually add the BB indicator from the ...\MQL5\Indicators\Examples\BB.mq5.
  2. I run the Expert Advisor on the same chart. I have added the Expert Advisor itself:
    //+------------------------------------------------------------------+
    //|                                                      ProjectName |
    //|                                      Copyright 2012, CompanyName |
    //|                                       http://www.companyname.net |
    //+------------------------------------------------------------------+
    void OnInit()
      {
       ResetLastError();
       if(!ChartIndicatorDelete(0,0,"Bollinger Bands"))
          Print("Error delete BB ",GetLastError());
      }
    //+------------------------------------------------------------------+
    I get an error

    ERR_CHART_INDICATOR_CANNOT_DEL

    4115

    Error when deleting the indicator from the chart


This error occurs because after deletion of the indicator from the EA, the chart window where BB was, though we can see it, but in fact it is already deleted. To check this, after running the Expert Advisor, switch to another profile in the terminal and then go back (to the old profile) and find that the chart has flushed like a cow.

My configuration:

2016.02.11 18:47:04.915 Terminal        MetaTrader 5 x64 build 1241 started (MetaQuotes Software Corp.)
2016.02.11 18:47:04.915 Terminal        Windows 10 Pro (x64 based PC), IE 11.63, UAC, Intel Core i3-3120 M  @ 2.50 GHz, RAM: 785 / 3981 Mb, HDD: 68822 / 233310 Mb, GMT+02:00
2016.02.11 18:47:04.915 Terminal        C:\Users\KVN\AppData\Roaming\MetaQuotes\Terminal\43 B472C43247368C5B97C7F22A1AE963
Files:
DeleteInd.mq5  1 kb
 
Karputov Vladimir:

Thanks for such a detailed and well-written question (it's been a long time since anyone has written like this!).

Here's what's going on:

  1. I manually add the BB indicator from the ...\MQL5\Indicators\Examples\BB.mq5.
  2. I am running the Expert Advisor on the same chart. I have added some changes to the Expert Advisor:
    I get an error

    ERR_CHART_INDICATOR_CANNOT_DEL

    4115

    Error when deleting the indicator from the chart


This error occurs because after deletion of the indicator from the EA, the chart window where BB was, though we can see it, but in fact it is already deleted. To check this, after running the Expert Advisor, switch to another profile in the terminal and then go back (to the old profile) and find that the chart has flushed like a cow.

My configuration:

When executing your code in the log I get only:

2016.02.11 20:14:01.996    Experts    expert DeleteInd (XAUUSD,M1) loaded successfully

But after I switch to another profile and come back the window is absent (though quotes in it were changing after adding an Expert Advisor).

Does it mean that this is a bug? As far as I understand, the ChartIndicatorDelete() function should not lead to such abnormal behavior of a chart. Is it possible to fix it?

 
DV2010:

When I execute your code, I only get it in the logbook:

2016.02.11 20:14:01.996    Experts    expert DeleteInd (XAUUSD,M1) loaded successfully

But after switching to another profile and coming back the window is absent (although quotes in it were changing after adding the Expert Advisor).

Does it mean that this is a bug? As far as I understand, the ChartIndicatorDelete() function should not lead to such abnormal behavior of a chart. Is it possible to fix it?

I have already reported it to the Service Desk.
 
They suggested that we should switch the mode of the Expert Advisor between Expert Advisor and Indicator in order to have one file. The same product will be installed on different terminals.

I made a switch. But what happened is the following: if I compile the mq4 file in the Experts folder, the program works only as an EA, as an indicator (when I copy it to the Indicators folder) it is not even set on the chart. But if I recompile it in this folder, everything is OK. The same goes for the EA, it will not be installed if it has been compiled in the Indicators folder. Please, tell me what is the reason for that? The compilation mode is strict, there are no errors.

 

In the latest build of MT5 1241 ChartIndicatorDelete function "messes up" the chart. The chart is not redrawn when resizing, the chart is not saved when closing the terminal, etc.

This has already been fixed. Please wait for the next build

 
Igor Ramensky:
Desk advised that there should be only one file,
Can you ask for the application number from the service desk?
 
Dear developers, could you tell me if recursion of functions and class methods is allowed in MQL? I make a recursive method call and get a stack overflow.
 
coderex:
Dear developers, could you advise whether recursion of class functions and methods is allowed in MQL? I'm making a recursive method call and getting a stack overflow.

Of course it's allowed. Otherwise you wouldn't get a stack overflow.

And what did you expect?

Do you control the recursion depth somehow?

 
Slawa:

Of course it's allowed. Otherwise you wouldn't get a stack overflow.

What did you expect?

Do you control the depth of recursion somehow?

I've already figured it out :) of course I'm sorry I stumbled, I haven't used recursion for a long time and I forgot about recursion depth control...
 
How often can activations be done? Or after one activation, how long before the next activation can take place?