Download MetaTrader 5

Wrong indicator values during backtesting - page 2

To add comments, please log in or register
whroeder1
15576
whroeder1  
int counter;
:
         if(counter<=N-1) //When I don't have N values of result[] to get its first average...
Since Build 600 variables are not initialized.
JdR9966
51
JdR9966  
WHRoeder:
Since Build 600 variables are not initialized.
Build 600 is a headache! What does it mean, that they don't have zero value for default?
Alain Verleyen
Moderator
32409
Alain Verleyen  
JdR9966:
Build 600 is a headache! What does it mean, that they don't have zero value for default?
It means they are not initialized, they can have any value (random). It's a common practice to initialize a variable.
JdR9966
51
JdR9966  
angevoyageur:
It means they are not initialized, they can have any value (random). It's a common practice to initialize a variable.


Ok, thank you for the help. I have to catch up with Build 600 asap.

I've initialized all the variables now, but it doesn't change the behaviour... Do you see something else in the code that can provoque the divergence?

whroeder1
15576
whroeder1  
JdR9966: Do you see something else in the code that can provoque the divergence?
  1. Why don't you start printing your variable values, before the IFs and trace statements inside so you learn why.
  2.    double stack[1];
       ArrayResize(stack,N);
    
    Make up your mind, either you want a fixed size, or dynamic (stack[])
.
JdR9966
51
JdR9966  
WHRoeder:
  1. Why don't you start printing your variable values, before the IFs and trace statements inside so you learn why.
  2. Make up your mind, either you want a fixed size, or dynamic (stack[])
.

Thank you for the help. The thing is that I wanted a N dimensional array, and the compiler gave an error when I was declaring it at a global level with a parametric N dimension, which is an external variable that I declare before. That's why I did it that way. Then I learnt that with the new 600 release, declaration of arrays cannot be parametric, so I already fixed it. The problem now is that I run the EA that calls this Indicator with the tester, and the behaviour is illogical in my opinion:


-Depending on the visual mode pace that I select, the graphical drawing of the indicator is different, and the values on one particular bar move as I change the pace selector.

-The graphical values of the indicator and the internal values (that I get with the prints spread in the code), are different.

And I am stuck here. I'm trying to learn how to use the debugger because it doesn't work as it should if I follow the help information, and it's being a pain in the neck.

Assuming there are some buggs in my code, why the speed selected in the visual mode testing is different? I can't understand why.

12
To add comments, please log in or register