28 !!! currency pairs, 1 expert. Another grail, but this one I think no one has ever shown. + DEMO ACCOUNT - page 12

 
Rosh:
I have tested "EURUSD over the range 2007.07.10 to 2007.07.14, and separately over the range 2007.07.09 to 2007.07.14" as you have asked, there is no difference.


I had to update to the latest build as well. :-) Indeed, the problems with time have disappeared, that's nice. However, as it turns out, the story doesn't end there.

I ran the EA on the same period - no difference between High and Low on M1 and on H1/D1. Note - I ran the test on my normal, unharmed data. No synchronisation, etc. So it can't be the reason for the discrepancy.

Then I decided to try it on another interval just in case (well, bad temper of mine). And it turns out it's not over yet.

Try the interval from 2007.08.06 to 2007.08.11, that is actually the last week. And the comparison is not with D1, but with H1. There are 4 operators in the text of the Expert Advisor that should be commented out, and 4 operators that should be uncommented. It's not that the possibility of spying into the future has been proved, no. But the glitch is present.

And since it appeared that the absence of problems on a weekly interval is not a guarantee that there are no problems at all, maybe we should run the test on a much longer interval, for example, a year or six months?

 
I have reviewed the code of your Simple Prospection EA. Unfortunately, it was not flawless, so I fixed it up a bit:

 
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {   
//----
  if (start)
   {
     curHi=NormalizeDouble(Bid,Digits);
     curLo=NormalizeDouble(Bid,Digits);
     curM1 = TimeMinute(TimeCurrent());
     curH1 = TimeHour(TimeCurrent());
     curD1 = TimeDay(TimeCurrent());
     start=false;
   }
 
  mm = TimeMinute(TimeCurrent());
  hh = TimeHour(TimeCurrent());
  dd = TimeDay(TimeCurrent());
  if (mm!=curM1)
  {  if (hh!=curH1)
     {  if (dd!=curD1)
        {  
           Print("Новые сутки наступили");
           curHi=NormalizeDouble(Bid,Digits);
           curLo=NormalizeDouble(Bid,Digits);
           curD1=dd;
        }
        //curHi=NormalizeDouble(Bid,Digits);
        //curLo=NormalizeDouble(Bid,Digits);
        curH1=hh;
     }
     curM1=mm;
  }
  if (NormalizeDouble(Bid,Digits)==0) Print(TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS),"  Bid=",Bid);
  if (NormalizeDouble(Bid,Digits)>curHi) curHi=NormalizeDouble(Bid,Digits);
  if (NormalizeDouble(Bid,Digits)<curLo) curLo=NormalizeDouble(Bid,Digits);
  //HiH1 = iHigh(NULL,PERIOD_H1,0);
  //LoH1 =  iLow(NULL,PERIOD_H1,0);
  HiH1 = iHigh(NULL,PERIOD_D1,0);
  LoH1 =  iLow(NULL,PERIOD_D1,0);
  HiH1 = NormalizeDouble(HiH1,Digits);
  LoH1 = NormalizeDouble(LoH1,Digits);
 
  str = TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS);
  mHi = ", curHi=" + DoubleToStr(curHi,Digits);
  mLo = ", curLo=" + DoubleToStr(curLo,Digits);
  hHi = ", HiH1="  + DoubleToStr(HiH1, Digits);
  hLo = ", LoH1="  + DoubleToStr(LoH1, Digits);
  if (curLo==0) Print("Curlo=",curLo);
  if (curHi==0) Print("curHi=",curHi);
 
  if (HiH1!=curHi||LoH1!=curLo) 
  {  //Print(str,mHi,hHi,mLo,hLo);
     if (handle>0) FileWrite(handle,TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS),curHi,HiH1,curLo,LoH1);
  }
//----
   return(0);
  }
 
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
{  Print("Работа закончена");
   if (handle>0)
      {FileWrite(handle,"записано ",TimeToStr(TimeLocal()));
      FileClose(handle);
      } 
//---- done
   return(0);
}
The fact of a new day is fixed too late in your code, in fact, on the second day, while the check of correctness of the simulation starts right after the start of the test. To exclude this asymmetry, I introduced a Boolean variable start, with which I fixed all test values at the beginning of the test.

  if (start)
   {
     curHi=NormalizeDouble(Bid,Digits);
     curLo=NormalizeDouble(Bid,Digits);
     curM1 = TimeMinute(TimeCurrent());
     curH1 = TimeHour(TimeCurrent());
     curD1 = TimeDay(TimeCurrent());
     start=false;
   }
As you can see, it works only once and doesn't affect the EA anymore. Further on, everything happens according to your algorithm. If you don't do primary initialization, then check strings

  if (curLo==0) Print("Curlo=",curLo);
  if (curHi==0) Print("curHi=",curHi);
will give value curLo=0, while curHi is not equal to zero. The explanation is simple: both variables curLo and curHi are initially equal to zero, since they are uninitialized. On the first tick, the condition

  if (NormalizeDouble(Bid,Digits)>curHi) curHi=NormalizeDouble(Bid,Digits);
is triggered and curHi already differs from zero, because the current Bid is greater than zero. At the same time, the current Bid cannot be less than zero (curLo was not initialized and therefore is zero), and therefore the condition

  if (NormalizeDouble(Bid,Digits)<curLo) curLo=NormalizeDouble(Bid,Digits);
cannot change curLo in any way. Run my version of the Expert Advisor yourself and check that the error file Fu.xls will contain only one line - the time of the last simulated quote in the tester.

Full code is attached to the post, better download it as it does not fit in the post.
 

Thanks, of course, to Rosh for your revision, but I don't think it was necessary.

Maybe you haven't noticed, but in my code in function init() there is the following block:

  curHi=0.0;
  curLo=1000.0;
  curD1=-1;
  curH1=-1;
  curM1=-1;

As a result of execution of this block, none of the conditions cannot be met at the beginning of execution of the EA.

if (mm!=curM1)
  {  if (hh!=curH1)
     {  if (dd!=curD1)
 

Therefore, no matter where in the history the EA starts, it will always be a new minute, a new hour, or a new day. And the first pair of operators of the mentioned block explains why your statement: "It's explained simply: both variables curLo and curHi are initially equal to zero, because they are uninitialized. Since Bid on the first tick is greater than zero, but less than 1000, both corresponding conditional statements are necessarily triggered and variables curLo and curHi get the same initial values you assign them in the if (start) block {...}.

Your version works just as well, but it doesn't affect the algorithm in any way. So this alteration will have no effect on presence or absence of errors.

Note again my previous post. The problem occurs not at the transition to a new day and not at the start of the EA but when testing the t/f H1. The problem occurs only once in this interval, on 10.08.2007 and lasts 3 minutes from 17:00 to 17:03. During this time 28 ticks are generated with divergence of High values for M1 and H1. I am showing you the appropriate picture.

If it is not difficult for you, please run the EA (the code you corrected) on that interval I asked for. Just correct the use of comments. Now in your code it compares with t/f D1 and there are no errors in this mode. I need it to compare with H1.

 

I changed the code a bit, to keep correctness in especially pathological cases (I have only one candle on M1 for 2007.01.01, same for H1 and D1). I ran the test from 2007.01.01 to 2007.08.11. I got 4 erroneous cases for D1 and 2 for H1. All the errors happen at the transition to a new candle on a higher TF. Those who want to see for themselves.

It does not give us possibilities to look into the future. At least in the peeping variant I checked.

Files:
future-2h.mq4  4 kb
 
Yurixx:

Thanks, of course, to Rosh for your revision, but I don't think it was necessary.

Maybe you haven't noticed, but in my code in init() function there is the following block:

  curHi=0.0;
  curLo=1000.0;
  curD1=-1;
  curH1=-1;
  curM1=-1;

If it's not difficult for you, run the EA (the code you corrected) on the interval I asked for. Just correct the use of comments. Now in your code it compares with t/f D1 and there are no errors in this mode. I need it to compare with H1.


You'd better post the code yourself. if you've noticed, when testing my code on H1 the values will not be initialised:
  if (Period()>PERIOD_M1)
  {  Print("Период тестирования не соответствует задаче");
     return(-1);
  }
  Print("Период тестирования ",Period()," минут");
  FileWrite(handle,"Date","Time","curHi","HiH1","curLo","LoH1");
  nn=D'2007.07.12 23:58:59';
  FileWrite(handle,TimeToStr(nn,TIME_DATE|TIME_SECONDS),
                   TimeSeconds(nn),TimeMinute(nn),TimeHour(nn),TimeDay(nn));
  nn=D'2007.07.13 00:58:59';
  FileWrite(handle,TimeToStr(nn,TIME_DATE|TIME_SECONDS),
                   TimeSeconds(nn),TimeMinute(nn),TimeHour(nn),TimeDay(nn));
  nn=D'2007.07.13 00:02:00';
  FileWrite(handle,TimeToStr(nn,TIME_DATE|TIME_SECONDS),
                   TimeSeconds(nn),TimeMinute(nn),TimeHour(nn),TimeDay(nn));
 
  curHi=0.0;
  curLo=1000.0;
  curD1=-1;
  curH1=-1;
  curM1=-1;

That is, it will be exactly as I wrote. If it is difficult for you to lay out the code so that I do not guess what it is about, then you yourself should understand it, I have other things to do than to practice telepathy.
 

Really, I don't understand why you're getting annoyed.

As I wrote on the last page when I posted the EA with the results, it is intended for testing exclusively on M1. At the same time it compares the High and Low it generates on its own, with the High and Low of the higher t/f, which could be H1 or D1, depending on that, how the comments are arranged in the text of the start() procedure.

Frankly speaking, I thought that return(-1); in the init() procedure will stop the work of the EA and therefore it will be possible to start it only on M1. However, now, thanks to your post, I am convinced that it can be run on any TF: The idea behind this EA is to try to spy the future from a lower t/f (specifically M1) on a higher t/f (specifically H1 or D1). Therefore it should only be run on M1. What testing on H1 might show I do not even know.

I posted the EA code just before your post. This code can be used directly to compare M1 data with H1 data. In the text of the EA there are clear indications of the (elementary) changes that need to be made for it to compare M1 data with D1 data. So here too, I'm not sure what you're unhappy about.

One last thing. Your code is as suitable for a tester run as mine is. It's just a matter of getting it done.

If you have other things to do, I won't bother you. I wasn't addressing you as a personal request, but as a representative of MQ in relation to the possible discovery of some glitches in the tester.

 
Yurixx:

Really, I don't understand why you're getting annoyed.

As I wrote on the last page when I posted the EA with the results, it is intended for testing exclusively on M1. At the same time it compares the High and Low it generates on its own, with the High and Low of the higher t/f, which could be H1 or D1, depending on that, how the comments are arranged in the text of the start() procedure.

Frankly speaking, I thought that it will stop the work of the Expert Advisor and it will be possible to start it only on M1. However, now, thanks to your post, I am convinced that it can be run on any TF: The idea behind this EA is to try to spy the future from a lower t/f (specifically M1) to a higher t/f (specifically H1 or D1). Therefore it should only be run on M1. What testing on H1 might show I do not even know.

I posted the EA code just before your post. This code can be used directly to compare M1 data with H1 data. In the text of the EA there are clear indications of the (elementary) changes that need to be made for it to compare M1 data with D1 data. So here too, I am not sure what you are unhappy about.

One last thing. Your code is as suitable for a tester run as mine is. It's just a matter of getting it done.

If you have other things to do, I won't bother you. I wasn't addressing you as a personal request, but as a representative of MQ in relation to the possible discovery of some glitches in the tester.

I dont understand what timeframe I should use to execute this test. I ran it on three timeframes without intervening in the code.

2007.08.14 16:29:03 2007.08.10 23:59 future-2h EURUSD,Daily: Work Finished
2007.08.14 16:29:03 2007.08.10 23:59 future-2h EURUSD,Daily: 2007.08.10 23:59:59, curHi=1.3693, HiH1=1.3702, curLo=1.3693, LoH1=1.3689
2007.08.14 16:29:02 2007.08.03 23:59 EURUSD,Daily: 2007.08.03 23:59:59, curHi=1.3773, HiH1=1.3787, curLo=1.3773, LoH1=1.3772
2007.08.14 16:29:02 2007.07.27 23:59 EURUSD,Daily: 2007.07.27 23:59:59, curHi=1.3635, HiH1=1.3641, curLo=1.3635, LoH1=1.3627
2007.08.14 16:29:02 2007.07.20 23:59:59 EURUSD,Daily: 2007.07.20 23:59:59, curHi=1.3826, HiH1=1.3827, curLo=1.3826, LoH1=1.3821
2007.08.14 16:29:01 2007.07.16 23:59:59 EURUSD,Daily: 2007.07.16 23:59:59, curHi=1.3772, HiH1=1.3773, curLo=1.3772, LoH1=1.3772
2007.08.14 16:29:01 2007.07.13 23:59:59 EURUSD,Daily: 2007.07.13 23:59:59, curHi=1.3782, HiH1=1.3787, curLo=1.3782, LoH1=1.3780
2007.08.14 16:29:01 2007.07.06 23:59:59 EURUSD,Daily: 2007.07.06 23:59:59, curHi=1.3625, HiH1=1.3630, curLo=1.3625, LoH1=1.3623
2007.08.14 16:29:01 2007.07.02 00:00 EURUSD,Daily: The test period is not appropriate
2007.08.14 16:29:01 future-2h started for testing
2007.08.14 16:28:34 2007.08.10 22:59 future-2h EURUSD,H1: Work Finished
2007.08.14 16:28:32 2007.07.02 00:00 future-2h EURUSD,H1: The testing period is not appropriate
2007.08.14 16:28:32 future-2h started for testing
2007.08.14 16:28:22 2007.08.10 22:59 future-2h EURUSD,M1: Work Finished
2007.08.14 16:28:19 2007.07.02 00:00 future-2h EURUSD,M1: Testing period of 1 minute
2007.08.14 16:28:19 future-2h started for testing
2007.08.14 16:24:28 2007.08.10 22:59 future-2h EURUSD,M1: Work Finished
2007.08.14 16:24:28 2007.08.06 00:00 future-2h EURUSD,M1: Testing period of 1 minute
 
Now change
  if (NormalizeDouble(Bid,Digits)>curHi) curHi=NormalizeDouble(Bid,Digits);
  if (NormalizeDouble(Bid,Digits)<curLo) curLo=NormalizeDouble(Bid,Digits);
  HiH1 = iHigh(NULL,PERIOD_H1,0);      // Закомментировать при тесте D1
  LoH1 =  iLow(NULL,PERIOD_H1,0);      // Закомментировать при тесте D1
  //HiH1 = iHigh(NULL,PERIOD_D1,0);    // Раскомментировать при тесте D1
  //LoH1 =  iLow(NULL,PERIOD_D1,0);    // Раскомментировать при тесте D1

to

  else if (hh!=curH1)
  {  //curHi=NormalizeDouble(Bid,Digits);  // Закомментировать при тесте D1
     //curLo=NormalizeDouble(Bid,Digits);  // Закомментировать при тесте D1
     curH1=hh;
     curM1=mm;
  }
  else if (mm!=curM1) curM1=mm;
  
  if (NormalizeDouble(Bid,Digits)>curHi) curHi=NormalizeDouble(Bid,Digits);
  if (NormalizeDouble(Bid,Digits)<curLo) curLo=NormalizeDouble(Bid,Digits);
  //HiH1 = iHigh(NULL,PERIOD_H1,0);      // Закомментировать при тесте D1
  //LoH1 =  iLow(NULL,PERIOD_H1,0);      // Закомментировать при тесте D1
  HiH1 = iHigh(NULL,PERIOD_D1,0);    // Раскомментировать при тесте D1
  LoH1 =  iLow(NULL,PERIOD_D1,0);    // Раскомментировать при тесте D1
and tested it again for three periods of the same time interval 2007.07.01 to 2007.08.11:
<br/ translate="no">
2007.08.14 16:32:03 2007.08.10 23:59 future-2h EURUSD,Daily: Work Finished
2007.08.14 16:32:03 2007.07.27 23:59 future-2h EURUSD,Daily: 2007.07.27 23:59:59, curHi=1.3753, HiH1=1.3753, curLo=1.3627, LoH1=1.3626
2007.08.14 16:32:01 2007.07.02 00:00 future-2h EURUSD,Daily: The testing period is not appropriate
2007.08.14 16:32:01 future-2h started for testing
2007.08.14 16:31:56 2007.08.10 22:59 future-2h EURUSD,H1: Work Finished
2007.08.14 16:31:54 2007.07.02 00:00 future-2h EURUSD,H1: Period of testing does not comply with task
2007.08.14 16:31:54 future-2h started for testing
2007.2007.08.14 16:31:48 2007.08.10 22:59 future-2h EURUSD,M1: Work completed
2007.08.14 16:31:46 2007.07.02 00:00 future-2h EURUSD,M1: Testing period 1 minute
2007.08.14 16:31:46 future-2h started for testing
What does it say? I have to analyse the code again for presence/absence of errors.
 

I see. You have done everything right. And this EA has to be run only on M1. I think I wrote it quite clearly. The Expert Advisor is run on M1 and it will test coincidence of High and Low data of M1 period with H1 or D1 period. If there was a peek into the future, then senior t/f data would let you know High and Low before those High and Low are reached on M1. That's it.

The result of your D1 test matches mine, on this interval for D1 I also got no errors. But the H1 test does not confirm what I got and posted a bit earlier. There is no need to analyze the code. As you see it confirms the normal operation of the tester.

If you think it is enough, you may stop here. If you want to make sure that it is not by accident, not because the period is too small, then run the same two tests on a longer period. Over a year, for example, or since the beginning of 2007.

PS

Just in case, I will repeat. Test only on M1 period. Only in all ticks mode..

Thank you for your participation.

 
Thank you for the test EAs, sometimes it's hard to come up with your own, as there are many test options and you don't always know what to test. And annoyance... You know, you get annoyed with your own people more often, because you expect them to understand. You get unintentionally tougher, and where you forgive others, you get frustrated with yours. I'm sorry.

These tests really help to improve the MetaTrader 4 tester. Especially with source code.
Reason: