Errors, bugs, questions - page 712

 
Hello,

Thanks for your reply, it helps to solve the declaration problem.

By the way I found maybe one bug related to debugging:

When you are debugging an indicator, being in breakpoint mode, press indicator list in MetaTrader.
The application freezes and is only stopped by the task manager (kill)


Please take note.
 
speedy:


Please take note.
Noted, thank you.
 

The OnTimer() function in the strategy tester, slows down execution quite a lot, when requested every second. void OnInit() { EventKillTimer(); EventSetTimer(1); } void OnTimer() { } Expert Advisor, with two external indicators and running through all ticks, is running 2012.04.11 14:32:07 Core 1 EURUSD,H1: 8083516 ticks (4557 bars) generated within 70418 ms (total bars in history 6270, total time 70528 ms) If OnTimer() is commented, execution is significantly accelerated 2012.04.11 14:36:22 Core 1 EURUSD,H1: 8083516 ticks (4557 bars) generated within 22730 ms (total bars in history 6270, total time 22870 ms) Are these delays caused by the tester, or can we speed it up somehow?

P.S. A preview of the message would have been implemented(

 
sion:

The OnTimer() function in the strategy tester, slows down execution quite a lot, when requested every second. void OnInit() { EventKillTimer(); EventSetTimer(1); } void OnTimer() { } Expert Advisor, with two external indicators and running through all ticks, is running 2012.04.11 14:32:07 Core 1 EURUSD,H1: 8083516 ticks (4557 bars) generated within 70418 ms (total bars in history 6270, total time 70528 ms) If OnTimer() is commented, execution is significantly accelerated 2012.04.11 14:36:22 Core 1 EURUSD,H1: 8083516 ticks (4557 bars) generated within 22730 ms (total bars in history 6270, total time 22870 ms) Are these delays caused by the tester, or can we speed it up somehow?

P.S. A preview of the message would have been implemented(

It's better to insert code through button "SRC" on editor panel.
 
papaklass:

What does this entry in the tester mean?

It is a system message about history paging.
 

Not funny.

struct Test
  {
   double      data[];
   int         size;
   void        Init(int Size) {size=Size; ArrayResize(data,fmin(size,Max));}
   double &operator[] (int i) {return &data[i];} // ERROR :  '&' - reference cannot be used

private:
   static int  Max;
  };
//+------------------------------------------------------------------+

int Test::Max=1024;
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   Test t;  
   t.Init(16);
   for(int i=0;i<t.size;i++)
     {
      t[i]=i*i; // ERROR :'=' - l-value required
     }
  }

I understand that links in general case in mql5 are not returned from functions (by the way, why not?), but then it's necessary to do something to make l-value indexers possible. For example, to make a syntax exception to the general rule for lefty indexers. Or a keyword of some kind.

The lameness obviously does not make mql5.... look nice.

 
MetaDriver:

Limp clearly doesn't make mql5.... look good

Don't insult mql5, it's still "tiny", but it matures very quickly from build to build.
 
MetaDriver:

The lameness clearly does not make mql5.... look good

You need to build full-fledged links for that :)

ZS: it's leaking :)

 

Bug?


The code below generates a sort of perpetual loop in the compiler. Clicking Cancel

doesn't work right away, but when it does, it regains control of the editor.

The Cancel button itself does not disappear, but it's not accessible either.

The Compile button is lost forever (you have to reload the editor to get it back)


#include <Object.mqh>.

class B;

class A: B {
void a();
};

class B: A {

CObject* a;
void b();
};
 
MetaDriver:

Not funny.

As I like to understand that links in general case in mql5 functions don't return (by the way, why can't they?), but I should do something to make l-value indexers possible instead, e.g. make a syntax exception to general rule for lefty indexers. Or a keyword of some kind.

The lameness clearly doesn't make mql5.... look nice.

"Passing" internal non-base class elements to the outside (and in this example not the attribute itself, but only an array element!) Especially with the possibility to change its value is not safe.

Besides, it contradicts the "spirit" of object-oriented programming: all work with object data should be performed inside the object, by its own methods...


How about just using Setter for the data attribute?

The code would win in readability. Eventually, this "simplicity" with the l-value indexer will make nobody understand how this code works...

You will spend more time searching for errors than writing Setter.

Here is an example:

If you can replace code like while ((double)date[++i -1] < 10) with something longer but digestible, you'd better do it that way...

struct Test

{

double data[];

int size;

void Init(int Size) {size=Size; ArrayResize(data,fmin(size,Max));}

void setDataElement (int index, double value)

{

data[index] = value;

}


private:

static int Max;

};

//+------------------------------------------------------------------+


int Test::Max=1024;

//+------------------------------------------------------------------+

//| Script program start function |

//+------------------------------------------------------------------+

void OnStart()

{

Test t;

t.Init(16);

for(int i=0;i<t.size;i++)

{

//t[i]=i*i; // ERROR :'=' - l-value required

t.setDataElement(i, i*i);

}

}

Reason: