Help understanding difference between "Optimisation results" and "Run Single Test" results

 

Hello, I can't figure out this error :

my results from the "optimisation result" tab differs from those i get when I right click and execute "Run Single Test" without changing anything else.


Any clue where to look to understand this differences ? 

For information : No error in the journal log when executing the optimisation backtest neither when executing a "single test"

Any help would be appreciated. 

Thanks in advance

 
winGou-:

Hello, I can't figure out this error :

my results from the "optimisation result" tab differs from those i get when I right click and execute "Run Single Test" without changing anything else.


Any clue where to look to understand this differences ? 

For information : No error in the journal log when executing the optimisation backtest neither when executing a "single test"

Any help would be appreciated. 

Thanks in advance

1. Can you check that the "Run Single Test" was effectively run with the same parameters (check in the log file) as the one you selected in the Optimization results ? I have already seen situation where the parameters where not correctly transferred.

2. If you run the backtest with the same parameters, it gives the same results each time ? (You could have to recompile your EA or remove the cache between each test to check that).

 
Alain Verleyen #:
1. Can you check that the "Run Single Test" was effectively run with the same parameters (check in the log file) as the one you selected in the Optimization results ? I have already seen situation where the parameters where not correctly transferred.

2. If you run the backtest with the same parameters, it gives the same results each time ? (You could have to recompile your EA or remove the cache between each test to check that).

Hi Alain,

First things first, thank you for your answer.


1 : I checked the parameters multiple times they are the exact sames. 

2 : If I understand your answer correctly, the backtest is not giving me the exact same results because i'm optimising a lot of parameters but they are nearly the same. On the other hand, each time i try to right click to execute a "single test" i get completely different result from the one which are displayed on the "optimisation tab result". How could I remove the cache ?   


In parallel I used the "Brute" force, adding some "Print()" functions everywhere in the code to check all my variables values, and I might have a small Array length error (which gives me no error but incorrect value) and I'm looking to see if it can comes from there. Would it be possible that the exact same EA behave differently in the "Backtest Optimisation" and the "Single test execution" with the same parameters ??

 
winGou- #:

Hi Alain,

First things first, thank you for your answer.


1 : I checked the parameters multiple times they are the exact sames. 

Ok.

2 : If I understand your answer correctly, the backtest is not giving me the exact same results because i'm optimising a lot of parameters but they are nearly the same. On the other hand, each time i try to right click to execute a "single test" i get completely different result from the one which are displayed on the "optimisation tab result". How could I remove the cache ?   


In parallel I used the "Brute" force, adding some "Print()" functions everywhere in the code to check all my variables values, and I might have a small Array length error (which gives me no error but incorrect value) and I'm looking to see if it can comes from there. Would it be possible that the exact same EA behave differently in the "Backtest Optimisation" and the "Single test execution" with the same parameters ??

Forget the optimization for a while. If your EA has a parameters P1=1, P2=2, P3=3 and you run a backtest (not an optimization), without changing the parameters, do you get the same results each time ? It should as you changed nothing.

 
Alain Verleyen #:
Ok.

Forget the optimization for a while. If your EA has a parameters P1=1, P2=2, P3=3 and you run a backtest (not an optimization), without changing the parameters, do you get the same results each time ? It should as you changed nothing.

I just modified the size of an Array that i was using to filter some buy/sell signals. My array was too short, and when i was calling a custom function it was filled with erroneous values. After this correction I get the correct results (same results than those in the optimization tab). 

I will be cautious before shouting victory but it might be ok for now. 

The array in question was to calculate a Moving Average with this custom function, and it needs to be at least longer than the period used in the MA (destination - length). When i was optimising the array was too short for some of the MAperiod tested. If you think this code could be improved feel free to share it with me. 

In any case, thank you again Alain for your help and your quick response.   

bool get_iMA(double & destination[], int length, double & open[], double & high[], double & low[], double & close[], ENUM_MA_METHOD mode, ENUM_APPLIED_PRICE applied_price)
  {
   double iMA_buffer[];
   ArraySetAsSeries(iMA_buffer, true);
   ArrayResize(iMA_buffer, ArraySize(destination));

   int iMA_values = iMA(_Symbol, TimeFrame, length, 0, mode, applied_price);

   for(int i = 0; i <= ArraySize(destination) - length ; i += 1)
     {
      if(CopyBuffer(iMA_values, 0, 0, ArraySize(destination), iMA_buffer) > 0)
        {
         destination[i]  = iMA_buffer[i];
        }
      else
        {
         return false;
         Print((string)magic_number + " Error copying MA Buffer");
        }
     }
   return true;
  }