Wrong indicator values during backtesting - page 2

To add comments, please log in or register
William Roeder
20356
William Roeder  
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
52
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
39048
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
52
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?

William Roeder
20356
William Roeder  
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
52
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.

HF2020
48
HF2020  

Hello everyone 

Not sure should I continue this topic or create new one - (sorry in advance if its not correct place)

I am using the following indicator to print the value of pivots (attached to this comment) 

When I open indicator on charts its showed me a different value once I'm using it in strategy-tester.

this is how I am using in my code to print the value of the buffer.

      double R3 = iCustom(_Symbol,PERIOD_H1,"Pivot_Points_-_Daily_sShiftedd",1,0,1);
        
      double R2 = iCustom(_Symbol,PERIOD_H1,"Pivot_Points_-_Daily_sShiftedd",1,1,1);

      double R1 = iCustom(_Symbol,PERIOD_H1,"Pivot_Points_-_Daily_sShiftedd",1,2,1);

      double Pivot=iCustom(_Symbol,PERIOD_H1,"Pivot_Points_-_Daily_sShiftedd",1,3,1);

      double S1 = iCustom(_Symbol,PERIOD_H1,"Pivot_Points_-_Daily_sShiftedd",1,4,1);

      double S2 =iCustom(_Symbol,PERIOD_H1,"Pivot_Points_-_Daily_sShiftedd",1,5,1);

      double S3 =iCustom(_Symbol,PERIOD_H1,"Pivot_Points_-_Daily_sShiftedd",1,6,1);

      Print("S3    = ",S3);
      Print("S2    = ",S2);
      Print("S1    = ",S1);
      Print("Pivot = ",Pivot);
      Print("R1    = ",R1);
      Print("R2    = ",R2);
      Print("R3    = ",R3);

I really appreciate your help if you can let me know what is wrong or how can I generate the same value in expert advisor.


** Please note that once I'm suing on chart I change the value of shifhour to 1 same as the one I used for iCunstom. ****


Thanks in advance 

12
To add comments, please log in or register