Multicurrency expert test results - page 4

 
tol64:
And could you show an example similar to what I did at the beginning of the branch. Include trading on one symbol only, but test it on another. Take a screenshot and test it on the symbol on which the test is running. Will there be divergence like that shown at the beginning of the branch? Although if the bar formation is tracked on all symbols, it should be identical. But you still need to check everything...

Well, I won't test it. I can post the code and you test it ;-):

string Instruments[] = ...
int SymbolCount = ArraySize(Instruments);

void RefreshRates(string symbol)
{
  MqlTick tick;
  SymbolInfoTick(symbol, tick);
  SymbolInfoDouble(symbol, SYMBOL_BID);
}

bool Synchronization()
{
  static bool Sync = true;

  string StrUnsync;
  int u = 0;

  datetime dt0 = (datetime)SeriesInfoInteger(_Symbol, Period(), SERIES_LASTBAR_DATE);
  
  for(int j = 0; j < SymbolCount; j++)
  {
    RefreshRates(Instruments[j]);
    datetime dt = (datetime)SeriesInfoInteger(Instruments[j], Period(), SERIES_LASTBAR_DATE);
    if(dt != dt0)
    {
      StrUnsync = StrUnsync + Instruments[j] + " ";
      u++;
    }
  }
  if(u > 0)
  {
    Print("Some symbols are unsynchonized:", StrUnsync);
    Sync = false;
    return(false);
  }
  else
  {
    if(!Sync)
    {
      Print("Synchronization done");
    }
    Sync = true;
  }
  return(true);
}

void OnTick()
{
  if(!Synchronization()) return;
  ...
}
 
marketeer:

Well, I won't test it. I can post the code and you test it ;-):

)) Thanks for the given variant. Now I will only check my conjecture, which was generated by pointing out a possible error by forum participants Yedelkin and Interesting, and then I will be glad to test your variant. I will report the results in details. ))
 

Yedelkin 

Note the part of the code:

Here you can see that you "hinge" some kind of "Spy Control panel MCM" indicator on two different characters. That is, you have different symbols as signal sources. But you claim that "we trade on EURUSD", i.e. the signal source is one and the same symbol. Let us be clear.

We trade only on EURUSD.

In my tests, I consider the scheme written by Konstantin Gruzdev -Implementation of the Multicurrency Mode in MetaTrader 5. ))) Everything is defined. The attached files contain the Spy Control panel MCM indicator and exSpy Control panel MCM Expert Advisor. By installing the Expert Advisor on a chart, you can see how it works. The log clearly shows the specified events received by the Expert Advisor from different symbols. Everything is clear, nothing is mixed.

I have now tried to specify in OnChartEvent() the symbol from which the ID is received, but this has not changed the results. I removed the second character from OnInit() to eliminate any possibility of receiving the wrong events. The test was now performed using this variant:

enum ENUM_CHART_EVENT_SYMBOL
  {
   CHARTEVENT_NO         = 0,          // События отключены
   CHARTEVENT_INIT       = 0,          // Событие "инициализация" 
   
   CHARTEVENT_NEWBAR_M1  = 0x00000001, // Событие "новый бар" на 1 -минутном графике
   CHARTEVENT_NEWBAR_M2  = 0x00000002, // Событие "новый бар" на 2 -минутном графике
   CHARTEVENT_NEWBAR_M3  = 0x00000004, // Событие "новый бар" на 3 -минутном графике
   CHARTEVENT_NEWBAR_M4  = 0x00000008, // Событие "новый бар" на 4 -минутном графике
   
   CHARTEVENT_NEWBAR_M5  = 0x00000010, // Событие "новый бар" на 5 -минутном графике
   CHARTEVENT_NEWBAR_M6  = 0x00000020, // Событие "новый бар" на 6 -минутном графике
   CHARTEVENT_NEWBAR_M10 = 0x00000040, // Событие "новый бар" на 10-минутном графике
   CHARTEVENT_NEWBAR_M12 = 0x00000080, // Событие "новый бар" на 12-минутном графике
   
   CHARTEVENT_NEWBAR_M15 = 0x00000100, // Событие "новый бар" на 15-минутном графике
   CHARTEVENT_NEWBAR_M20 = 0x00000200, // Событие "новый бар" на 20-минутном графике
   CHARTEVENT_NEWBAR_M30 = 0x00000400, // Событие "новый бар" на 30-минутном графике
   CHARTEVENT_NEWBAR_H1  = 0x00000800, // Событие "новый бар" на 1 -часовом графике
   
   CHARTEVENT_NEWBAR_H2  = 0x00001000, // Событие "новый бар" на 2 -часовом графике
   CHARTEVENT_NEWBAR_H3  = 0x00002000, // Событие "новый бар" на 3 -часовом графике
   CHARTEVENT_NEWBAR_H4  = 0x00004000, // Событие "новый бар" на 4 -часовом графике
   CHARTEVENT_NEWBAR_H6  = 0x00008000, // Событие "новый бар" на 6 -часовом графике
   
   CHARTEVENT_NEWBAR_H8  = 0x00010000, // Событие "новый бар" на 8 -часовом графике
   CHARTEVENT_NEWBAR_H12 = 0x00020000, // Событие "новый бар" на 12-часовом графике
   CHARTEVENT_NEWBAR_D1  = 0x00040000, // Событие "новый бар" на дневном графике
   CHARTEVENT_NEWBAR_W1  = 0x00080000, // Событие "новый бар" на недельном графике
     
   CHARTEVENT_NEWBAR_MN1 = 0x00100000, // Событие "новый бар" на месячном графике   
   CHARTEVENT_TICK       = 0x00200000, // Событие "новый тик"
   
   CHARTEVENT_ALL        = 0xFFFFFFFF, // Все события включены
  };

...

int OnInit()
{
 if(iCustom("EURUSD",PERIOD_D1,"Spy Control panel MCM",ChartID(),0,CHARTEVENT_TICK) == INVALID_HANDLE)
   { Print("Ошибка установки шпиона на EURUSD"); return(true);}

 return(0);
}

void OnChartEvent(const int id,         // идентификатор события
                  const long&   lparam, // флаг события поступившего от агента панели.
                                        // Флаги соответствуют перечислению ENUM_CHART_EVENT_SYMBOL.
                  const double& dparam, // цена
                  const string& sparam  // инструмент 
                 )
{
 // Объявление массивов переменных для торговых сигналов
 static datetime New_Bar[1];  
 static bool UpSignal[1], DnSignal[1];
 
 if(id >= CHARTEVENT_CUSTOM)
   {
    if(sparam == Symbol_01)
      {
       // Получение торговых сигналов
       TradeSignalCounter(0,Symbol_01,Trade_01,Timeframe_01,UpSignal,DnSignal,New_Bar);
      
       // Совершение торговых операций
       TradePerformer(0,Symbol_01,Trade_01,Timeframe_01,Stop_Loss_01,Take_Profit_01,Slippage_01,UpSignal,DnSignal,New_Bar);
      }
   }
}

A test on the EURUSD symbol from the EURUSD chart:

Test on EURUSD tool from GBPUSD chart:

The results are not consistent.

Interesting

Judging by this code, the signals indeed come from two symbols but the Expert Advisor can process one of these signals with a delay.

The second symbol is no longer present, the signals come only fromEURUSD. But unfortunately this does not solve the problem.

 
marketeer:

Well, I won't test it. I can post the code and you test it ;-):

Tested your version. )) The results are almost identical. It may be good enough for preliminary (quick) testing. We will use the OnTimer() function to get absolutely identical results.

Here are the results of testing:

Test on EURUSD tool from EURUSD chart:

Test on EURUSD tool from GBPUSD chart:

 
MetaDriver:

I think 10 sec is too short an interval. If only formed bars are of interest, the interval should be at least one minute.

There is no point in making it shorter, a minute is the minimum reasonable interval...

Did another series of tests to show the inconsistency of the results above 10 seconds. We will compare with the same "benchmark", which was provided at the beginning of the topic. That is, from the OnTick() function by the formed daily bars when the Expert Advisor is on the symbol under test. Here it is:

Then all results will be from the OnTimer() function. The Expert Advisor is on GBPUSD symbol:

Test on EURUSD symbol from GBPUSD chart. The timer interval is 10 seconds:

This is the most accurate result.

Test on EURUSD symbol from GBPUSD chart. Timer interval is 1 minute:

This is not true. The result was even significantly better, which is also incorrect and misleading.

A test on EURUSD from GBPUSD chart. The timer interval was 60 minutes:

The result does not coincide with the benchmark in many places.

Test on EURUSD from GBPUSD chart. Timer interval is 1 day:

The result is more than anything else non-identical.

-------------------------

In general, to be completely confident of the correct results, multicurrency Expert Advisors should be tested through the OnTimer() function, setting the minimum interval.

 
tol64:

Did another series of tests to show the inconsistency of the results above 10 seconds. We will compare with the same "benchmark", which was provided at the beginning of the topic. That is, from the OnTick() function by the formed daily bars when the Expert Advisor is on the symbol under test. Here it is:

Then all results will be from the OnTimer() function. The Expert Advisor is on GBPUSD symbol:

Test on EURUSD symbol from GBPUSD chart. The timer interval is 10 seconds:

This is the most accurate result.

Test on EURUSD symbol from GBPUSD chart. The timer interval is 1 minute:

Not correct. The result is even significantly better, which is also wrong and misleading.

A test on EURUSD from GBPUSD chart. The timer interval is 60 minutes:

The result does not coincide with the benchmark in many places.

Test on EURUSD from GBPUSD chart. The timer interval is 1 day:

The result is more than anything else non-identical.

-------------------------

In general, to be completely confident of the correct results, multicurrency Expert Advisors should be tested through the OnTimer() function while setting the minimum interval.

I do not quite understand. You have made a wrong comparison.

The first test is correct: comparison of two ways of testing - on "your" tool and on another one. And then you took this first result as a benchmark and compared all the other results to it.

This is not correct. You should compare the rest of the identity runs not with the first result, but with runs of the same ticking frequency on "your" instrument.

They will be different from the "10 second", it's only natural, the main thing is that they should be pairwise identical.

Please complete the test.

Otherwise it will turn out that you only wasted your time, strangely managing to confirm your initial illusion "about the advantages of the 10-second test" .

 
tol64:

Tested your option. )) The results are almost identical. It is good enough for preliminary (quick) testing. To get completely identical results we will use OnTimer() function.

As far as I understand, it's not my way of synchronization that you are testing now, but MetaTrader's tick generator. The point is that when you run the test, different tick bases were generated - under the name of eurusd and under the name of gbpusd, and the results are almost never equal. In reality, if you run two EAs with the specified synchronization block on different symbols, the difference should be negligible or none at all.
 
MetaDriver:

I don't quite get it. Something you compared incorrectly.

The first test is correct: comparing two ways of testing - on "your" instrument and on another. And then you took that first result as a benchmark and compared all the other results to it.

This is not correct. You should compare the rest of the identity runs not with the first result, but with runs of the same ticking frequency on "your" instrument.

They will be different from the "10 second", it's only natural, the main thing is that they should be pairwise identical.

Please complete the test.

Otherwise it will turn out to be a waste of time, because it strangely manages to confirm its initial illusion of "the advantages of the 10-second testing".

Good. Now I've already started another long test. It will be over when I wake up. But I can already tell you that they are identical in pairs, because I've seen it. All that's left is for me to show you. But you could do the same test yourself. It is an important point in testing trading systems. I may be doing something wrong)).

P.S. The main thing was that they must not be identical in pairs because when testing through the function OnTimer() they appear to be identical in any case. The aim was initially to make them identical to the result obtained in the normal mode using the OnTick() function with explicit check of bars. Expert Advisors trading on one symbol do it perfectly. But in the multicurrency mode it was necessary to find out. The result is obvious.

 
marketeer:
As far as I understand, it is not my way of synchronisation that you have now tested, but MetaTrader's tick generator. The point is that when you ran the tests you generated different tick bases - under the name eurusd and under the name gbpusd, and the results for them will almost never be equal. In reality, if you run two EAs with the specified synchronization block on different symbols, the difference should be negligible or none at all.
What reality are you talking about? Real time testing? If so, then I agree of course. If you hang two EAs on their symbols, everything will be correct. But I'm testing the multi-currency mode. And an identical result is shown only using OnTimer() (10 seconds).
 
tol64:

Trading is only on EURUSD.

Let's start with the correct wording. In the initial example you would like to have "trade on EURUSD". In fact, custom events were received from two symbols, and in the event handler TradeSignalCounter()+TradePerformer() were called when events were received from any of these two symbols. We can assume that the event queue was always full.

Now you have removed one of the signal sources but entered the check"if(sparam == Symbol_01)" in the event handler for some reason. But the next question is different. Judging by the code, Lizar's scheme is used in "All ticks" mode and functions TradeSignalCounter()+TradePerformer() are called at every tick from the signal source (EURUSD). Interesting has already hinted on possible overflow of the event queue. But I want to know what instrument is used as Symbol_01 parameter of these two functions, and whether you've tried to change the periodicity of events in Lizar's scheme.

Reason: