how come a line of my backtest has a profit x and a dd y....and when i run the single test the profit and dd is way different from the backtest line result? - page 3

 
Fernando Carreiro #:

There is no use in showing us videos or to continue this discussion.

Without source code we cannot analyse how the EA is working in order to explain the discrepancies.

99% percent of the time, the problem is the EA code, so contact the EA's author, and resolve the issue with them.

but did u saw the video?

the high values of the settings its no issue?

 
tadeu23 #: but did u saw the video? the high values of the settings its no issue?
Contact the EA author. Discuss it with them!
 
Alain Verleyen #:
I don't see how this directive "tester_everytick_calculate" could explain the difference between an optimization pass and a single backtest without visual mode (as it's done when started from the optimization window). Do you have any reproducible example ?

https://www.mql5.com/en/code/21700

https://www.mql5.com/en/code/21247


If an indicator checks for updates in only all or 1 rates, it gives errors: when in non visual mode, an indicator would only call OnCalculate when called in a CopyBuffer so if it is not accessed during some candle you could get an OnCalculate where rates_total==prev_calculated+3, for example. Also in non visual the backtest does only the open price tick for each candle, in visual it does open-high-low-close (only open for code, the other 3 for indicators), and indicators get updated in all ticks. In the example there are also other CopyBuffers that would miss data if they don't update 1 by 1 (and would have data from open only, instead of close, so that also changes even when going 1 by 1). In visual or live charts they usually work perfectly though.


You can test them with a simple EA like this one:

input string indicatorName = "NAME";
input int mainBuffer = 0;
input int displace = 1;
input int daysToPrint = 2;
input int jump = 0;
input bool only_hash = false;


int handle;


//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

union LongDouble 
{ 
  long long_value; 
  double double_value; 
};

//int file=0;

long hash;

int OnInit()
{
        hash = 0;
        
        //if (!MQLInfoInteger(MQL_VISUAL_MODE))
        //      file=FileOpen("_NONVISUALTEST.txt", FILE_COMMON|FILE_WRITE|FILE_TXT|FILE_ANSI);

   handle = iCustom(Symbol(), PERIOD_CURRENT, indicatorName);



   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
        //if (!MQLInfoInteger(MQL_VISUAL_MODE))
        //{
        //      FileWrite(file, "\nHash: ", hash);
        //      FileClose(file);
        //}
        //else
                Print("\nHash: ", hash);
                
}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+

datetime TimeStamp;
int jumpCount=0;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
{
   if(TimeStamp!=iTime(_Symbol,PERIOD_CURRENT,0))
   {
      TimeStamp=iTime(_Symbol,PERIOD_CURRENT,0);
      if (jumpCount<jump)
      {
         jumpCount++;
         return;
      }
      else
      {
         jumpCount=0;
      }

      double val[];
      CopyBuffer(handle, mainBuffer, displace, daysToPrint, val);

      string to_print = "";

      for (int j = 0; j < daysToPrint; j++)
      {
        LongDouble lb;
        lb.double_value = val[j];
      
        hash = hash ^ lb.long_value;
        
        if (!only_hash)
                to_print += DoubleToString(val[j]) + " ";
      }
                if (!only_hash)
                {
                        //if (!MQLInfoInteger(MQL_VISUAL_MODE))
                        //      FileWrite(file, to_print);
                        //else
                Print(to_print);
                }
                        
      
   }
}
//+------------------------------------------------------------------+

There are multiple indicators that have errors of this kind, but to be fair there is no way (that I know) to test an indicator in non visual mode by itself!

Damiani_Volatmeter
Damiani_Volatmeter
  • www.mql5.com
Damiani Volatmeter - trend/flat determining algorithm.
 
Manuel Alejandro Cercos Perez #:

https://www.mql5.com/en/code/21700

https://www.mql5.com/en/code/21247


If an indicator checks for updates in only all or 1 rates, it gives errors: when in non visual mode, an indicator would only call OnCalculate when called in a CopyBuffer so if it is not accessed during some candle you could get an OnCalculate where rates_total==prev_calculated+3, for example. Also in non visual the backtest does only the open price tick for each candle, in visual it does open-high-low-close (only open for code, the other 3 for indicators), and indicators get updated in all ticks. In the example there are also other CopyBuffers that would miss data if they don't update 1 by 1 (and would have data from open only, instead of close, so that also changes even when going 1 by 1). In visual or live charts they usually work perfectly though.


You can test them with a simple EA like this one:

There are multiple indicators that have errors of this kind, but to be fair there is no way (that I know) to test an indicator in non visual mode by itself!

Hello Manuel Alejandro Cercos Perez

look at this tests ive made

I select this line


And run the non visual single backttest

Here are the results:


Than i and run the visual single backttest...

Here are the results:


All 3 very different results... 

So what u think?

Manuel Alejandro Cercos Perez
Manuel Alejandro Cercos Perez
  • 2022.11.12
  • www.mql5.com
Trader's profile
 
If non visual and optimization are different then it must be using different conditions in the EA for trading based on whether it is an optimization pass or not (I don't know any other way to make those different)
Reason: