Errors, bugs, questions - page 2009

 
fxsaber:
Why no Warnings at all, that the variable is not used?

Because it is initialised.

 
Alexey Viktorov:

Because it is initialized.

So what difference does it make? It's initialised with a constant. Even this code should generate Warning

void OnStart()
{
  int Array[];
  int i;
  
  i = Array[0];
  i = Array[1];
  i = Array[2];
}

Because the variable and the array are not involved anywhere.

 
fxsaber:

So what difference does it make? It's initialised with a constant. Even this code should generate Warning

Because the variable and the array don't participate anywhere.

I think such code must not compile at all because the array size is not defined. But it's just a nitpick.

Well, how come they don't take part? A variable is assigned an array cell value. This is what they take part in calculations. How can the compiler know about your future plans? I think that doing it the way you imagine it would probably be right, but very hard. If you try to present an algorithm of such checking, you can write the following: the programmer checks if a variable is assigned some value. If not, it means that it is not used. Try to give a rough algorithm for determining that a variable is initialized, but is not used anywhere else in calculations.

The number of variables with the same name... is questionable.

 
Alexey Viktorov:

How would the compiler know about your future plans?

The compiler sometimes throws out whole chunks because it knows

Forum on trading, automated trading systems and strategy testing

Alternative implementations of standard functions/approaches

Renat Fatkhullin, 2016.09.01 23:50

To avoid the compiler throwing out the loop because it's useless, you have to use the results of calculations. For example, make Print variable Price.

 
fxsaber:

The compiler throws out whole chunks sometimes because it knows

Well, if Renat hasn't had enough of answering, let's wait for his answer. And in principle I am personally satisfied with everything.

 
Please, if the work in the kodobase has been updated (the author has tweaked the code), mark the relevant discussion thread as unread.
 

How do I make a #uninclude?

// Test.mqh
void Func() {};
#include <Test.mqh>

// Здесь видна Func();

#uninclude <Test.mqh>

// Здесь не видна Func();
 

Correct either the value or the unit

2017.09.21 11:37:27.564 Tester  EURUSD: preliminary downloading of history ticks started, it may take quite a long time
2017.09.21 11:37:32.564 Tester  EURUSD: "bases\FIBOGroup-MT5 Server\ticks\EURUSD\201708.tkc" download (836044.77 Kb/sec)
2017.09.21 11:37:41.565 Tester  EURUSD: 45% ticks downloaded (535.34 Kb/sec)
2017.09.21 11:37:49.565 Tester  EURUSD: 53% ticks downloaded (518.17 Kb/sec)
2017.09.21 11:38:01.571 Tester  EURUSD: 61% ticks downloaded (530.69 Kb/sec)
2017.09.21 11:38:12.571 Tester  EURUSD: 70% ticks downloaded (547.64 Kb/sec)
2017.09.21 11:38:26.572 Tester  EURUSD: 82% ticks downloaded (543.88 Kb/sec)
2017.09.21 11:38:38.573 Tester  EURUSD: 94% ticks downloaded (552.07 Kb/sec)
2017.09.21 11:38:50.573 Tester  EURUSD: preliminary downloading of history ticks completed, 44.41 Mb in 1:23.008 (547.80 Kb/sec)
 
fxsaber:

How do you make a #uninclude?

You cannot do it directly. Code refactoring (different file structure or OOP) will help.

 
in the CopyTicks tester returns zeros, is this normal?
Reason: